Inspecting Dockerfiles created by other parties

Before you start creating new Dockerfiles, it is a good idea to have a look at what others did. Many pre-built community images are available including the used Dockerfile which gives you insight into how the image is constructed but also helps you and your IT to know whether there are potential security issues with the published images.
In this example, we will have a look at a Dockerfile which has been created for the tool trimmomatic.
On DockerHub, there are a lot of examples – we will take this one.

FROM ubuntu:latest

ENV DEBIAN_FRONTEND noninteractive

ADD /tmp/trimmomatic.tar.gz

RUN set -e \
      && ln -sf bash /bin/sh

RUN set -e \
      && apt-get -y update \
      && apt-get -y dist-upgrade \
      && apt-get -y install --no-install-recommends --no-install-suggests \
        default-jdk make \
      && apt-get -y autoremove \
      && apt-get clean \
      && rm -rf /var/lib/apt/lists/*

RUN set -e \
      && tar xvf /tmp/trimmomatic.tar.gz -C /opt --remove-files \
      && mv /opt/trimmomatic-* /opt/trimmomatic \
      && cd /opt/trimmomatic \
      && make

RUN set -e \
      && mkdir /opt/trimmomatic/bin \
      && echo '#!/usr/bin/env bash' > /opt/trimmomatic/bin/trimmomatic \
      && echo 'java -jar /opt/trimmomatic/classes/trimmomatic.jar ${@}' \
        >> /opt/trimmomatic/bin/trimmomatic \
      && chmod +x /opt/trimmomatic/bin/trimmomatic

ENV PATH /opt/trimmomatic/bin:${PATH}

ENTRYPOINT ["/usr/bin/java", "-jar", "/opt/trimmomatic/classes/trimmomatic.jar"]

This example shows how you could create a Docker image by installing trimmomatic and its dependencies from scratch. While this is a perfectly valid approach, we recommend using specific bioinformatics tools from Bioconda since this community does a lot of maintenance work for us.
Furthermore, as we will see in the next examples, you can create very readable Dockerfiles by using tools from Bioconda.