Create the Docker image

To create a Docker image containing MAFFT, we will create a Dockerfile describing the steps needed to build this image from a base image.

In a text file named "Dockerfile" (without any file extension), enter the following:

FROM ubuntu:16.04
MAINTAINER user@domain.com
RUN apt-get update
RUN apt-get install -y wget
RUN mkdir mafft-bin
RUN wget -O /mafft-bin/mafft.tgz https://mafft.cbrc.jp/alignment/software/mafft-7.450-linux.tgz
RUN tar xfvz /mafft-bin/mafft.tgz

These statements indicate that the image is to be built on top of Ubuntu 16.04, with the creator's identity specified in the MAINTAINER field. The RUN statements state that wget should be installed, and the MAFFT binary should be downloaded from a public archive and unpacked into a local folder called "/mafft-linux64/" in the Docker container.

An executable called "mafft.bat" is located in the /mafft-linux64/, and it is this executable that we will be using in our external application.

A local docker image can now be built using the Dockerfile and the docker build command. From the directory containing the Dockerfile, run the following command:

docker build . -t example/mafft:0.0.1

When the above command is run, the Ubuntu image is retrieved if it is not already present, and the RUN steps in the Dockerfile are performed. An image is created with the name "example/mafft" and the tag "0.0.1".

Before we configure the external application, we will step through testing our Docker image and (optionally), uploading the image to DockerHub.