Created
July 2, 2015 16:28
-
-
Save timjrobinson/3fc5cc8128cee6b4d0ff to your computer and use it in GitHub Desktop.
Spawn selenium docker containers on a host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./run-selenium-container 9000 5 - Will create 5 selenium containers running on ports 9000, 9001, 9002, 9003, 9004 | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
START_PORT=${1:-4444} | |
TOTAL_CONTAINERS=${2:-1} | |
for (( I = 0; I < $TOTAL_CONTAINERS; I++ )); do | |
PORT=$(($START_PORT + $I)) | |
echo "Creating container on port $PORT" | |
CONTAINER_ID=$(sudo docker run -d --volume=/home/ubuntu/ci:/home/ubuntu/ci -it --privileged --name="selenium-$PORT" -p $PORT:4444 selenium/standalone-chrome:2.46.0) | |
sleep 5 | |
sudo tail -f /var/lib/docker/aufs/diff/$CONTAINER_ID/var/log/supervisor/* > /var/log/selenium-container-$PORT.txt & | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment