Skip to content

Instantly share code, notes, and snippets.

@koddr
Created July 13, 2020 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koddr/802d86ad1bac40de8f211cb896910e6e to your computer and use it in GitHub Desktop.
Save koddr/802d86ad1bac40de8f211cb896910e6e to your computer and use it in GitHub Desktop.
Docker Hub README example for X project (replace to yours).

Quick reference

Supported tags and respective Dockerfile links

Quick reference (cont.)

What is project X?

Some words about the Project X.

logo

How to use this image

Simple example

$ docker run --name some-project-x -v /some/content:/usr/share/:ro -d user/project-x

Alternatively, a simple Dockerfile can be used to generate a new image that includes the necessary content (which is a much cleaner solution than the bind mount above):

FROM user/project-x
COPY static-html-directory /usr/share

Place this file in the same directory as your directory of content (in static-html-directory), run docker build -t some-content-project-x ., then start your container:

$ docker run --name some-project-x -d some-content-project-x

Complex example

$ docker run --name my-custom-project-x-container -v /some/content:/usr/share/:ro -d user/project-x

For information on the syntax of the Project X configuration files, see the official documentation (specifically the Beginner's Guide).

Image Variants

The user/project-x images come in many flavors, each designed for a specific use case.

user/project-x:<version>

This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.

user/project-x:<version>-alpine

This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.

To minimize image size, it's uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

License

View license information for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment