Skip to content

Instantly share code, notes, and snippets.

@dersam
Created September 23, 2016 14:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dersam/70de2d7e505fa9bb32378f953d295ada to your computer and use it in GitHub Desktop.
Save dersam/70de2d7e505fa9bb32378f953d295ada to your computer and use it in GitHub Desktop.
Start a docker machine for running tests via Webdriver with the elgalu/selenium container
#!/usr/bin/env bash
docker-machine start default
docker rm -f grid
docker run --rm --name=grid --add-host='develop.vagrant.dev:192.168.80.80' -p 4444:24444 -p 5920:25900 \
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium:2.51.0b > /dev/null &
sleep 5
docker exec grid wait_all_done 30s
eval $(docker-machine env default)
echo "Machine IP: "
docker-machine ip default
@elgalu
Copy link

elgalu commented Sep 24, 2016

You may want to change the version 2.51.0b to latest ;)

If you want to run it in the background with & you can get rid of that by changing --rm with -d i.e. daemon mode.

You can wait just 1 or 2 seconds instead of 5 as the wait_all_done will wait only what's necessary.

docker run -d --name=grid --add-host='develop.vagrant.dev:192.168.80.80' -p 4444:24444 -p 5920:25900 \
  -v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium

sleep 1 && docker exec grid wait_all_done 30s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment