Skip to content

Files

Latest commit

 

History

History

docker

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Docker setup instructions for SeleniumBase

1. Install the Docker Desktop:

You can get that from here: https://www.docker.com/products/docker-desktop/

You might also want to install the Docker Engine: https://docs.docker.com/engine/install/

2. Go to the SeleniumBase home directory on the command line, which is where Dockerfile is located. (This assumes you've already cloned the SeleniumBase repo.)

3. Create your Docker image from your Dockerfile: (Get ready to wait awhile)

(Windows / Linux / Intel macOS)

docker build -t seleniumbase .

(Apple Silicon macOS, eg. M1/M2/M3/M4):

Users should first Enable Rosetta in Docker Desktop. (Otherwise Chrome will crash on launch with errors such as: "InvalidSessionIdException" and "Unable to receive message from renderer")

Enable Rosetta

Then you can run these commands:

export DOCKER_DEFAULT_PLATFORM=linux/amd64

docker build --platform linux/amd64 -t seleniumbase .

4. Run the example test with Chrome inside your Docker: (Once the test completes after a few seconds, you'll automatically exit the Docker shell)

docker run seleniumbase ./run_docker_test_in_chrome.sh

5. You can also enter Docker and stay inside the shell:

docker run -i -t seleniumbase

6. Now you can run the example test from inside the Docker shell:

./run_docker_test_in_chrome.sh

7. When you're satisfied, you may exit the Docker shell:

exit

8. (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:

Details on that can be found here: http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers

Here are a few of those cleanup commands:

docker container prune
docker system prune
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi
docker rm 'docker ps --no-trunc -aq'

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.)

docker rm -f $(docker ps -a -q)
docker rmi -f $(docker images -q)

For more cleanup commands, check out: https://codefresh.io/blog/everyday-hacks-docker/

9. (Optional) More reading on Docker can be found here: