Using Docker with RevBayes

Last modified on October 20, 2020

Setting up Docker

Setting up Docker

The first step to this is installing Docker. For Windows or MacOS this means installing Docker Desktop. For Linux this means installing just regular old Docker. For this tutorial I will also be using vscode which is an open-source editor made by Microsoft (strange as that sentence is for me to type). The tutorial could easily be done in the terminal also (e.g. PowerShell, bash). If you want to use vscode you will also need the Remote Explorer extension. If you search remote in the extensions tab its the one called Remote - Containers. This lets us connect our vscode window to the docker container.

OK now we at least have Docker. We can run the Docker pull (currently this is not hosted on our organization page). Run this command in your terminal: docker pull

This will pull the image down which will take a bit. After this completes you will be able to run a Rev terminal using: docker run –rm -it

If you want a terminal inside of the container you can use: docker run -it –entrypoint /bin/bash revbayesdockerfiles:ubuntu-latest

Without any errors you opened either revbayes or a terminal inside the container.

Developing in the Docker container

Developing in the Docker container

Ok now we are ready to get the container running. Use:

docker run --entrypoint /bin/bash revbayesdockerfiles:ubuntu-latest

The container is now running. We just need to start it. To figure out the name of the container (since we didn’t give it one), type docker container ls. It should have a name of two random words, mine is peaceful-hertz.

You want to start this with docker start

Now we can go to vscode type: CTRL(CMD)+SHIFT+P. This opens the command prompt. Type in Remote it will populate a drop-down list go to the one that says: Remote-Container: Attach to running container. This will open a new window and in the bottom left corner it should say ‘Container: revbayesdockerfiles-latest’.

The revbayes repository is in here. If we want to open it you can go to Open folder and navigate to that. It will be at /revbayes.

If you want to debug you will need to install a debugger. For example, to install gdb, you can simply use the apt install manager (or yum/dnf on fedora/CentOS). You could also do this to install valgrind which does not work nicely on MacOS. Otherwise you can use them just as you would in terminal on your home machine. I am currently working on a full development environment that takes advantage of a more IDE-like environment for debugging so stay-tuned.