Skip to content

Running ANTS2 in a docker container

vovasolo edited this page Jun 19, 2019 · 9 revisions

This mini-HOWTO describes how to have ANTS2 running on your computer inside a Docker container. This is so far the easiest and fastest way to get ANTS2 up and running on either Linux, Mac or Windows. Here I assume that Docker is already installed on the system and your current user has sufficient privileges to run it.

Start by creating folders on your computer to be shared with the ANTS2 container:

  • config to retain ANTS2 configuration between the sessions
  • data to exchange the data between the container and the host system. This folder will be mapped to /data in the container.

For example, you can use the following snippet on Linux or MacOS:

mkdir $HOME/ants2
mkdir $HOME/ants2/config
mkdir $HOME/ants2/data

The following procedure depends on the host OS and on the way how the ANTS2 GUI is accessed from the host system. Note that the first time you use docker run command, the image gets downloaded from Docker Hub and unpacked, so it takes a few minutes before it actually runs. The next time the container starts in a few seconds.

Linux: X11

Run in a terminal: docker run -it -v $HOME/ants2/config:/ants_config -v $HOME/ants2/data:/data -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -e UID=$(id -u) -e GID=$(id -g) -e USER=$USER vovasolo/ants2-x11

Or, to use a container with an integrated Geant4 back-end (larger download): docker run -it -v $HOME/ants2/config:/ants_config -v $HOME/ants2/data:/data -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -e UID=$(id -u) -e GID=$(id -g) -e USER=$USER vovasolo/a2g4x11

Once created, a container can be re-used:

  • Find the "CONTAINER ID" with the following command: docker ps -a
  • Start the container (<cont_id> is the "CONTAINER ID", e.g. 71ea16b14cbb): docker start <cont_id>

Windows: X11

  • Install a program to run X-window server on Windows, e.g. MobaXterm (https://mobaxterm.mobatek.net)
  • Find out DISPLAY address assigned in this program, e.g. in MobaXterm: click "Start local terminal" and the output will show the assigned DISPLAY: "Your DISPLAY is set to 192.168.1.5:0.0"
  • Modify the DISPLAY address in the lines below!

To run ANTS2: docker run -it -e DISPLAY=192.168.1.5:0.0 -v /tmp/.X11-unix:/tmp/.X11-unix -v ants_config:/ants_config -v data:/data -e UID=1000 -e GID=1000 -e USER="antsman" vovasolo/ants2-x11

To run ANTS2 with Geant4 back-end: docker run -it -e DISPLAY=192.168.1.5:0.0 -v /tmp/.X11-unix:/tmp/.X11-unix -v ants_config:/ants_config -v data:/data -e UID=1000 -e GID=1000 -e USER="antsman" vovasolo/a2g4x11

Linux, Windows and MacOS: noVNC in a web browser

  1. start the container with the following command: docker run -it -p 6901:6901 -v $HOME/ants2/data:/data -v $HOME/ants2/config:/headless/.config/ants2 vovasolo/ants2-novnc bash
  2. Open web browser and point it to http://localhost:6901/vnc.html, in the password prompt enter: vncpassword
  3. A desktop will open in the browser window. Double click the ant icon on the left and enjoy