Create a docker container

Create a docker container

The easiest way to create, publish and share a docker container is via the docker hub, here

https://hub.docker.com/.

The information, how a docker container is build is then stored in a text file called ‘Docker’. A typical dockerfile could look this this

##################################################################################################  
# Set the starting image
  FROM ubuntu:zesty

  MAINTAINER Daniel Fischer <daniel.fischer@luke.fi>
  
##################################################################################################  
# Install the required system components
  RUN apt-get update && apt-get install -y \
        openjdk-8-jre \
        python \
        git \
        wget \
        unzip \
     && rm -rf /var/lib/apt/lists/*  
  
##################################################################################################  
# Setup the folder structure (if needed)  
  RUN mkdir /data
  RUN mkdir /data/fromHost

################################################################################################## 
# Install the required binaries

# ------------
# Cufflinks 2.2.1
# ------------
  RUN wget http://cole-trapnell-lab.github.io/cufflinks/assets/downloads/cufflinks-2.2.1.Linux_x86_64.tar.gz
  RUN tar -xzf cufflinks-2.2.1.Linux_x86_64.tar.gz
  RUN mv /cufflinks-2.2.1.Linux_x86_64 /bin
  RUN rm cufflinks-2.2.1.Linux_x86_64.tar.gz
 
#-------------
# FastQC 0.11.5
# ------------
  RUN wget http://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v0.11.5.zip
  RUN unzip fastqc_v0.11.5.zip
  RUN chmod +x /FastQC/fastqc
  RUN mv /FastQC /bin/
  RUN rm fastqc_v0.11.5.zip
  
# ------------
# STAR 2.5.2b:
# ------------
  RUN wget -qO- https://github.com/alexdobin/STAR/archive/2.5.2b.tar.gz | tar -xz
  RUN mv /STAR-2.5.2b/ /bin/STAR-2.5.2b/
  
# ------------
# HiSAT2 2.0.5:
# ------------
  RUN wget -qO- ftp://ftp.ccb.jhu.edu/pub/infphilo/hisat2/downloads/hisat2-2.0.5-Linux_x86_64.zip > hisat2-2.0.5-Linux_x86_64.zip
  RUN unzip hisat2-2.0.5-Linux_x86_64.zip
  RUN mv hisat2-2.0.5 /bin/
  RUN rm hisat2-2.0.5-Linux_x86_64.zip    
  
# -----------
# StringTie 1.33
# -----------
  RUN wget -qO- http://ccb.jhu.edu/software/stringtie/dl/stringtie-1.3.3.Linux_x86_64.tar.gz  | tar -xz
  RUN mv stringtie-1.3.3.Linux_x86_64/stringtie /bin
  
##################################################################################################   
# Set the the environment variables
  ENV PATH $PATH:/bin/STAR-2.5.2b/bin/Linux_x86_64_static/:/bin/hisat2-2.0.5/:/bin/FastQC/:/bin/cufflinks-2.2.1.Linux_x86_64/

Details on the different options in a dockerfile are still required to be explained here!

Once we have a docker file, we can create locally the docker container by typing (in the same folder, where the ‘Dockerfile’ is located)

docker build -t user/example:0.1 -t user/example:latest .

Here, the ‘-t’ is used to tag the docker build. In Out example we assign the version number 0.1 and also declare it to be the latest. (There is an issue with the latest label, that I’ll explain later, for now this double tagging should be, however, sufficient). Besides the version number of the docker container, the docker image needs a name (here: example) and an associated username from docker hub (here: user). Depending on the complexity of the Dockerfile, the building process might take a while. Once the building is ready, we can push the image to the Docker hub by running

docker push user/example:0.1 
docker push user/example:latest

Instead of creating docker images that contain only libraries, it is also possible to create docker images that contain data only. In that case, the dockerfile just downloads the datafiles.

If you use the docker daemon the first time to submit a image, you need to login to docker first. For that you need to run (:before you push the image):

docker login
 (Enter user and password)

 

%d bloggers like this: