Skip to content

Docker Setup Guide#

To get the repository set up on non-Linux environments, you can use the pre-configured Docker environment ("Linux/amd64") specified by the "Dockerfile".

Installing Docker#

First, install Docker Desktop, and accept the terms.

Open Docker Desktop, and wait until it is running before proceeding.

Verify the installation:

docker --version

docker run hello-world

Troubleshooting Installation Issues on Mac#

On Mac, if verification fails, try:

/Applications/Docker.app/Contents/Resources/bin/docker --version

If that works, as a one time setup step, update the ".zshrc" file to add the installed location to the path:

# this is the "~/.zshrc" file...
export PATH="/Applications/Docker.app/Contents/Resources/bin:$PATH"

Remember to restart your shell afterwards:

source ~/.zshrc

Now you should be able to verify the installation:

docker --version

docker run hello-world

Image Operations#

Ensure you have navigated to the root directory of the repository, where the "Dockerfile" is located, before proceeding.

Build the image:

docker build -t sbsim-docker-env .

Listing images:

docker images

Removing the image, as necessary:

docker rmi sbsim-docker-env

Container Operations#

After the image is built, run the container (in interactive mode, with open ports):

docker run -it -p 8888:8888 -v $(pwd):/workspace sbsim-docker-env

NOTE: the container will copy the repository into "/workspace/sbsim" on the first run. Use -v to persist changes.

To access Jupyter notebooks, visit http://localhost:8888 in the browser.

To run scripts or tests inside the actively running docker container:

# activate the virtual environment:
source /opt/venv/bin/activate

# navigate to the repository:
cd /workspace/sbsim

# running scripts:
python path/to/script.py

# running tests:
pytest

To stop the container:

docker stop sbsim-docker-env

Listing containers (to get their identifiers):

docker ps -a

Removing a container:

docker rm <container-id>

NOTE: in the future we would like to further update these instructions and improve the Dockerfile. See issue #80 (contributions welcome)!