|
| 1 | +## Docker setup instructions for SeleniumBase |
| 2 | + |
| 3 | +#### 1. Get the Docker Toolbox from https://www.docker.com/docker-toolbox and install it. |
| 4 | + |
| 5 | +#### 2. Create your SeleniumBase Docker environment: |
| 6 | + |
| 7 | + docker-machine create --driver virtualbox seleniumbase |
| 8 | + |
| 9 | +#### 3. If your Docker environment ever goes down for any reason, you can bring it back up with a restart: |
| 10 | + |
| 11 | + docker-machine restart seleniumbase |
| 12 | + |
| 13 | +#### 4. Configure your shell: |
| 14 | + |
| 15 | + eval "$(docker-machine env seleniumbase)" |
| 16 | + |
| 17 | +#### 5. Go to the SeleniumBase home directory. (That's where "Dockerfile" is located) |
| 18 | + |
| 19 | +#### 6. Create your Docker image from your Dockerfile: (Get ready to wait awhile) |
| 20 | + |
| 21 | + docker build -t seleniumbase . |
| 22 | + |
| 23 | +#### 7. Run a test inside your Docker: (Once the test completes after a few seconds, you'll automatically exit the Docker shell) |
| 24 | + |
| 25 | + docker run seleniumbase ./run_docker_test_in_firefox.sh |
| 26 | + |
| 27 | +#### 8. You can also enter Docker and stay inside the shell: |
| 28 | + |
| 29 | + docker run -i -t seleniumbase |
| 30 | + |
| 31 | +#### 9. Now you can run the example test from inside the Docker shell: (This time using PhantomJS) |
| 32 | + |
| 33 | + ./run_docker_test_in_phantomjs.sh |
| 34 | + |
| 35 | +#### 10. When you're satisfied, you may exit the Docker shell: |
| 36 | + |
| 37 | + exit |
| 38 | + |
| 39 | +#### 11. (Optional) Since Docker images and containers take up a lot of space, you may want to clean up your machine from time to time when they’re not being used: |
| 40 | +http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers |
| 41 | +Here are a few of those cleanup commands: |
| 42 | + |
| 43 | + docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi |
| 44 | + docker rm 'docker ps --no-trunc -aq' |
| 45 | + |
| 46 | +If you want to completely remove all of your Docker containers and images, use these commands: (If there's nothing to delete, those commands will return an error.) |
| 47 | + |
| 48 | + docker rm $(docker ps -a -q) |
| 49 | + docker rmi $(docker images -q) |
| 50 | + |
| 51 | +Finally, if you want to wipe out your SeleniumBase Docker virtualbox, use these commands: |
| 52 | + |
| 53 | + docker-machine kill seleniumbase |
| 54 | + docker-machine rm seleniumbase |
| 55 | + |
| 56 | +#### 12. (Optional) More reading on Docker can be found here: |
| 57 | +* https://docs.docker.com |
| 58 | +* https://docs.docker.com/mac/started/ |
| 59 | +* https://docs.docker.com/installation/mac/ |
0 commit comments