Test the Docker image locally

We can now use the docker image just created to run MAFFT locally in a Docker container.

At its simplest, a command like the following can be run, leading to the MAFFT help information being displayed:

docker run example/mafft:0.0.1 /mafft-linux64/mafft.bat --help

To generate an alignment, we need to supply a FASTA format file as input to MAFFT. This data file must be placed in an area visible to both the host system and the container. In this example, we will be using the docker -v command to bind mount a local directory to a container location.

We will put a FASTA format file containing sequences to align, called sequences.fa into a local folder called /home/user1/dockersharearea/. To run a container with MAFFT, to align this set of sequences, we would run:

docker run -v /home/user1/dockersharearea:/mnt/mafft
example/mafft:0.0.1 /mafft-linux64/mafft.bat /mnt/mafft/sequences.fa

This command includes the -v option with values specifying that the local directory
/home/user1/dockersharearea/ should be bind mounted to /mnt/mafft in the container. The final option specifies and where the input data will be found within the container.

The progress of the job is reported to the console, as is the alignment generated.

After successfully testing the image, you can proceed to configure a containerized external application, as described in Configure the containerized MAFFT external application. Optionally, you can also upload the image to a repository, such as Amazon Elastic Container Repository (AWS ECR) or DockerHub at this point, as described in Upload the Docker image to a repository and then use that image in your external application rather than a local one.