Docker development setup#

Docker Image#

The repository provides one development Dockerfile under docker/:

Dockerfile.dev

Python 3.12 development image with all MRax runtime feature dependencies including the GUI stack, plus test, documentation, notebook, Git, Git LFS, and native system packages commonly needed by development workflows.

For day-to-day development, use docker/Dockerfile.dev.

Build the Development Container#

From the repository root, build the development image:

docker build -f docker/Dockerfile.dev -t mrax-dev .

Run an interactive shell with the current checkout mounted at /workspace:

docker run --rm -it -v "$PWD":/workspace -w /workspace mrax-dev

Inside the container, install the mounted checkout in editable mode:

python -m pip install -e ".[all,dev,docs,notebooks]"

Run the standard checks:

python -m pytest
sphinx-build -E -b html docs docs/_build/html

To start Jupyter from the container and access it on the host:

docker run --rm -it -p 8888:8888 -v "$PWD":/workspace -w /workspace mrax-dev
python -m pip install -e ".[all,dev,docs,notebooks]"
jupyter lab --ip=0.0.0.0 --no-browser --NotebookApp.token=''

Then open http://localhost:8888 on the host.

Starting the GUI#

Build the frontend assets as described in Contribution guide, then run:

mrax-gui --host 0.0.0.0 --no-browser

Forward port 8765 to localhost and open it in your browser. With docker run, add -p 127.0.0.1:8765:8765 when creating the container.

VS Code Dev Container#

Choose a dev container configuration, both using docker/Dockerfile.dev:

  • CPU (default): .devcontainer/devcontainer.json. Standard CPU JAX.

  • NVIDIA GPU: .devcontainer/gpu/devcontainer.json. GPU passthrough and CUDA 12-enabled JAX.

With Docker running, use Dev Containers: Reopen in Container and select a configuration. The post-create step installs MRax with runtime and development extras:

python -m pip install -e ".[all,dev,docs,notebooks]"

The post-create step also creates data/ for local test measurements and tmp/ for results and scratch work. Both are ordinary workspace folders, ignored by Git and excluded from container images. Add test data manually to data/.

NVIDIA GPU Development#

The GPU configuration runs MRax in a Linux container, including on Windows through WSL 2. It enables --gpus=all and installs CUDA-enabled JAX:

python -m pip install -e '.[all,dev,docs,notebooks]' 'jax[cuda12]>=0.4.35,<0.11'

The host needs an NVIDIA GPU and compatible driver. Configure the NVIDIA Container Toolkit on Linux or Docker Desktop WSL 2 GPU support on Windows. JAX’s pip extra supplies CUDA libraries. See JAX requirements.

After switching configurations, run Dev Containers: Rebuild Container. Verify GPU access inside the container:

python -c "import jax; print(jax.devices())"