Docker image for the Avida digital evolution software platform

Docker image for the Avida digital evolution software platform

Many people have problems trying to install Avida in their computers. If you work on GNU/Linux (or Mac) you will not have any problems cloning Avida from the GitHub developers repository or from our GitLab repository (if you want to get our latest extensions). In contrast, people using Windows most likely will have to install Avida as a Docker image.

This a step-by-step guide to install the Ubuntu Docker image that we have previously built in our lab. We first describe the process of building and uploading the image into Docker Hub. Therefore,  you can skip the first two sections and go directly to the section "Downloading the image from Docker Hub" to learn how to install the image in your computer.

Building an Ubuntu image containing Avida:

We create the following file, named "Dockerfile", using a text editor:

FROM ubuntu:20.04 as avida-build
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /gitlab.com/fortunalab/
RUN apt-get update && apt-get install -y \
gcc-9 \
g++-9 \
cmake=3.16.3-1ubuntu1 \
make=4.2.1-1.2 \
git=1:2.25.1-1ubuntu3.5 \
curl \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100 \\ && git clone https://gitlab.com/fortunalab/avida.git
WORKDIR /gitlab.com/fortunalab/avida
RUN git submodule foreach git fetch
RUN git submodule update
RUN git submodule init
RUN ./build_avida

FROM ubuntu:20.04
WORKDIR /avida/
COPY --from=avida-build /gitlab.com/fortunalab/avida/cbuild/work/ .

Next, we  build the image by calling the docker file stored in our gitlab repository:

docker build https://gitlab.com/fortunalab/avida/-/raw/master/doker@images/avida/ubuntu/Dockerfile -t fortunalab/avida:2.15.ubuntu

The above code for the compilation reads the content of the "Dockerfile" and executes the following two steps:

First, a temporal image named "avida-build" is created. This temporal image is used to install the required tools, clone the Avida repository from GitLab and compile the Avida software platform.

Second, a smaller image named "fortunalab/avida:2.15.ubuntu" is created from a clean Ubuntu 20.04 image by adding only the compiled software.

Uploading the image into Docker Hub:

Docker Hub is the world's largest repository of container images with an array of content sources including container community developers, open source projects and independent software vendors (ISV) building and distributing their code in containers. Users get access to free public repositories for storing and sharing images or can choose subscription plan for private repos.

We have uploaded the docker image containing Avida into Docker Hub. First, we logged in Docker Hub:

docker login

Then, we pushed the image to our public repository in Docker Hub:

docker push fortunalab/avida:2.15.ubuntu

The image is available at Docker Hub

Downloading the image from Docker Hub:

Install Docker:

Before downloading the image, you should have Docker installed in your computer. Docker provides documentation for different operating systems to help you in this process.

Once Docker is installed, the daemon should be initialized and the process enabled to start on boot. We check that Docker is running by executing (you need root privileges to do it):

sudo systemctl status docker

In order to execute Docker without root privileges, you need to add your username to the docker group (by default, the docker command can only be run by the root user or by a user in the docker group):

sudo usermod -aG docker username

Now, we apply the new group membership by typing the following:

su - username

You need to log out and log back to that the group membership is re-evaluated:

Then, we check that your username is now added to the docker group by typing:

id -nG

Finally, we can view system-wide information about Docker by typing:

docker info

You might need to change the permissions in order to connect to Docker (e.g., Got permission denied while trying to connect to the Docker daemon socket ...):

sudo chmod 777 /var/run/docker.sock

Download the Docker image:

Now, we login in Docker Hub from the command line as username:

docker login

download the image by typing:

docker pull fortunalab/avida:2.15.ubuntu

and check that the image has been downloaded to our computer:

docker images

Running Avida from the Docker image stored in our computer:

docker run -it avida:2.15.ubuntu /bin/bash

Go to the Avida folder:

cd avida

Check the version of Avida:

./avida -version

We should see the following output:

Now, you are ready to run your experiments using Avida.

Show Comments