/
Creating a Dockerfile

Creating a Dockerfile

 

Intro:

Now that you have your container working, you need to make a Dockerfile.  iPlant won’t pull your image from hub.docker because they have no idea what you’ve put in it.  Instead, iPlant wants a Dockerfile that is used to build your container.  This is basically the steps you used get your previous container working, but in a single file.  They aren’t too hard to make, just follow some best practices and iPlant will be happy.

 

  1. Details on building images with a Dockerfile: https://docs.docker.com/reference/builder/
  2. Best practices for making a Dockerfile: https://docs.docker.com/articles/dockerfile_best-practices/

Steps:

  1. Write your Dockerfile
  2. Dockerfile for hisat2 based on ubuntu 14.04.3
    1. Dockerfile
    2.         FROM ubuntu:14.04.3
              MAINTAINER Eric Lyons
              RUN apt-get update && apt-get install -y \
                build-essential \
                git \
                python
      
              ENV BINPATH /usr/bin
              ENV SRCPATH /usr/src
              ENV HISAT2GIT https://github.com/infphilo/hisat2.git
              ENV HISAT2PATH $SRCPATH/hisat2
              
              RUN mkdir -p $SRCPATH 
              WORKDIR $SRCPATH
              RUN git clone "$HISAT2GIT"
              RUN make -C $HISAT2PATH \
                && cp $HISAT2PATH/hisat2 $BINPATH \
                && cp $HISAT2PATH/hisat2-* $BINPATH
              
              ENTRYPOINT ["/usr/bin/hisat2"]
              
    3. Note:  There are options to define default behavior of Docker Image when run.
      1. ENTRYPOINT defines what should be run when the image is run, and is ideal when a tool consists of a single main program. 

      2. CMD can also be added to define default arguments to pass to the entrypoint when none are provided; frequently this is used to pass e.g. "–help" by default

  3. To build your docker image:
    1. docker build <directory with Dockerfile>
    2. Note: You can add the option: -t <tag> to create an easier to use name for using the docker image
  4. Once built, you can test 
    1. docker run <image number>

Next Step