How to build Bioinformatic tools image for docker

Docker is getting popular for Serverless application. In this article, I would like to show how to build a docker image for Bioinformatic tools like Bowtie. You can find what Bowtie is at


Installing Docker
For Mac
1. Let’s start with downloading docker for Mac from this url:
2. Mount Docker.dmg, install by dragging to Applications dir.

install docker
3. Docker (the whale icon) should now appeared on the Applications, click on Docker to being the installation. Follow the installation instruction.
4. When installation is complete, Open terminal and check by running:

$ docker --version

which should response like this:

Docker version 1.12.0, build 8eab29e

5. Docker is ready!

Creating a docker image with bioconda environment
Bioconda is a channel of bioinformatic tools for a package manager, Conda. Most of the tools can be easily installed with Bioconda, so a docker image with bioconda environment is required.
1. Create working directory.

mkdir docker-conda
cd docker conda

2. Create Dockerfile

touch Dockerfile

3. Using editor, put following lines to Dockerfile.

FROM ubuntu

This tells docker to use ubuntu as base image.

RUN apt-get -y update
RUN apt-get install -y wget gzip zip bzip2 python

Update and install the required packages.

RUN mkdir /usr/tools && cd /usr/tools
RUN mkdir /usr/tools/bin
WORKDIR /usr/tools

Create working directory in the image.

RUN wget

Download miniconda installer.

RUN echo "yes\nyes\n" > conda_inst_stdin.txt

Create input fot miniconda installer’s prompt.

RUN bash < conda_inst_stdin.txt

Install conda.

ENV PATH /root/miniconda2/bin:$PATH

Add conda’s executable path to environment.

RUN conda config --add channels r
RUN conda config --add channels bioconda
RUN conda list

Add bioconda channel.

ADD . /data

Add current directory to the container at ‘/data’ and change container’s working directory to ‘/data/’
4. To build the image, run ‘docker build’.

docker build -t docker-conda .

5. Test integrity of bioconda by running:

docker run docker-conda conda --version

Which should print current version of conda

conda 4.1.11

Create automate build from github repository
1. Create github repository with the dockerfile.

2. Create account and log in to
3. Click ‘Create‘ and select ‘Create Automate build‘.


4. Click ‘Create Auto-Build Github‘.


5. Select github repository which would be auto-built.


6. Enter description of the repository.


7. Click create.

Install Bowtie1 with conda
To install bowtie to the image, put following line to Dockerfile:

RUN conda install -y bowtie

Build image.

docker build -t docker-conda .

Test If bowtie installed correctly. Run:

docker run docker-conda bowtie -v


Let’s start with building reference index for bowtie. Create directory ‘reference’.

mkdir reference

Build the reference fasta file using bowtie.

docker run -v `pwd`:/data -w /data docker-conda bowtie-build reference/ref.fa reference/ref


Check the index. There should be some files with .ebwt extension.

docker run -v `pwd`:/data -w /data docker-conda ls -al reference


Run mapping reference index with sequence.fastq .

docker run -v `pwd`:/data -w /data docker-conda bowtie reference/ref sequence.fastq > map.sam


2 thoughts on “How to build Bioinformatic tools image for docker

  1. Hello,

    Thanks for your post, when I ran:
    docker build -t docker-conda .

    I got the following error:
    E: Failed to fetch 503 Service Unavailable [IP: 80]

    E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?
    Fetched 7097 kB in 42s (167 kB/s)
    The command ‘/bin/sh -c apt-get install -y wget gzip zip bzip2 python’ returned a non-zero code: 100

    Any help?

Leave a Reply

Your email address will not be published.