Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Guidelines for Creating Dockerfiles

Scott Collier edited this page Mar 23, 2014 · 17 revisions
README

We would like to provide a consistent experience for consumers of Dockerfiles. We are providing some guidelines here that will help.

  • Each Dockerfile example should include a README that contains the following.

    • The version of Docker that it was created and tested on.

      • For example: Tested on Docker 0.9.0

    • Instructions on how to build the Docker image.

      • For example: docker build -rm -t example/example

    • Instructions on how to run the Docker image

      • If the Dockerfile has to do with any container that needs to store persistent data outside the container, such as a database, the example needs to show how to do this.

      • If the Dockerfile has an application that exposes ports, show how to perform a port to port mapping ( -p 80:80) and a random port mapping ( -p 80 ).

    • How to test it and confirm functionality

      • If the container is running MongoDB, show how to connect to it with the MongoDB client (mongo --port 49127). If the container is running a web server, show how to access the web site (curl http://localhost:49127), etc…​

Don’t include executable scripts. Just provide the scripts and mark them executable in the Dockerfile. For example: ADD ./script.sh /usr/bin/ RUN chmod -v 775 /usr/bin/script.sh

Clone this wiki locally