2014-09-04 21:09:00 -04:00
page_title: Guidelines for Official Repositories on Docker Hub
page_description: Guidelines for Official Repositories on Docker Hub
page_keywords: Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, official, image, documentation
2014-09-08 20:32:29 -04:00
# Guidelines for Creating and Documenting Official Repositories
2014-09-08 19:30:39 -04:00
## Introduction
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
You’ ve been given the job of creating an image for an Official Repository
2014-09-23 18:51:17 -04:00
hosted on [Docker Hub Registry ](https://registry.hub.docker.com/ ). These are
2014-09-23 21:26:02 -04:00
our guidelines for getting that task done. Even if you’ re not
2014-09-23 17:21:00 -04:00
planning to create an Official Repo, you can think of these guidelines as best
practices for image creation generally.
2014-09-04 21:09:00 -04:00
2014-09-23 18:51:17 -04:00
This document consists of two major sections:
2014-09-08 14:43:09 -04:00
2014-09-24 19:05:35 -04:00
* A list of expected files, resources and supporting items for your image,
along with best practices for creating those items
2014-09-04 21:09:00 -04:00
* Examples embodying those practices
2014-09-08 19:30:39 -04:00
## Expected Files & Resources
2014-09-04 21:09:00 -04:00
2014-09-08 19:30:39 -04:00
### A Git repository
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
Your image needs to live in a Git repository, preferably on GitHub. (If you’ d
like to use a different provider, please [contact us ](mailto:feedback@docker.com )
directly.) Docker **strongly** recommends that this repo be publicly
accessible.
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
If the repo is private or has otherwise limited access, you must provide a
2014-09-23 18:51:17 -04:00
means of at least “read-only” access for both general users and for the
docker-library maintainers, who need access for review and building purposes.
2014-09-04 21:09:00 -04:00
2014-09-24 19:05:35 -04:00
### A Dockerfile
2014-09-04 21:09:00 -04:00
Complete information on `Dockerfile` s can be found in the [Reference section ](https://docs.docker.com/reference/builder/ ).
2014-09-23 17:21:00 -04:00
We also have a page discussing [best practices for writing `Dockerfile`s ](/articles/dockerfile_best-practices ).
2014-09-04 21:09:00 -04:00
Your `Dockerfile` should adhere to the following:
2014-09-23 17:21:00 -04:00
* It must be written either by using `FROM scratch` or be based on another,
established Official Image.
2014-09-24 19:05:35 -04:00
* It must follow `Dockerfile` best practices. These are discussed on the
[best practices page ](/articles/dockerfile_best-practices ). In addition,
2014-09-24 19:05:35 -04:00
Docker engineer Michael Crosby has some good tips for `Dockerfiles` in
2014-09-23 17:21:00 -04:00
this [blog post ](http://crosbymichael.com/dockerfile-best-practices-take-2.html ).
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
While [`ONBUILD` triggers ](https://docs.docker.com/reference/builder/#onbuild )
are not required, if you choose to use them you should:
2014-09-08 15:36:52 -04:00
2014-09-23 17:21:00 -04:00
* Build both `ONBUILD` and non-`ONBUILD` images, with the `ONBUILD` image
built `FROM` the non-`ONBUILD` image.
* The `ONBUILD` image should be specifically tagged, for example, `ruby:
2014-09-24 19:05:35 -04:00
latest`and `ruby:onbuild` , or `ruby:2` and `ruby:2-onbuild`
2014-09-04 21:09:00 -04:00
2014-09-08 19:30:39 -04:00
### A short description
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
Include a brief description of your image (in plaintext). Only one description
is required; you don’ t need additional descriptions for each tag. The file
should also:
2014-09-04 21:09:00 -04:00
* Be named `README-short.txt`
* Reside in the repo for the “latest” tag
2014-11-03 12:12:05 -05:00
* Not exceed 100 characters
2014-09-04 21:09:00 -04:00
2014-09-08 19:30:39 -04:00
### A logo
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
Include a logo of your company or the product (png format preferred). Only one
logo is required; you don’ t need additional logo files for each tag. The logo
file should have the following characteristics:
2014-09-04 21:09:00 -04:00
* Be named `logo.png`
* Should reside in the repo for the “latest” tag
2014-09-24 19:05:35 -04:00
* Should fit inside a 200px square, maximized in one dimension (preferably the
width)
2014-09-23 17:21:00 -04:00
* Square or wide (landscape) is preferred over tall (portrait), but exceptions
2014-09-24 19:05:35 -04:00
can be made based on the logo needed
2014-09-04 21:09:00 -04:00
2014-09-08 19:30:39 -04:00
### A long description
2014-09-04 21:09:00 -04:00
2014-09-24 19:05:35 -04:00
Include a comprehensive description of your image (in Markdown format, GitHub
2014-09-24 19:05:35 -04:00
flavor preferred). Only one description is required; you don’ t need additional
descriptions for each tag. The file should also:
2014-09-04 21:09:00 -04:00
* Be named `README.md`
* Reside in the repo for the “latest” tag
2014-09-23 17:21:00 -04:00
* Be no longer than absolutely necessary, while still addressing all the
2014-09-24 19:05:35 -04:00
content requirements
2014-09-04 21:09:00 -04:00
In terms of content, the long description must include the following sections:
2014-09-24 19:05:35 -04:00
* Overview & links
* How-to/usage
* Issues & contributions
2014-09-08 19:30:39 -04:00
#### Overview & links
2014-09-04 21:09:00 -04:00
2014-09-23 21:26:02 -04:00
This section should provide:
* an overview of the software contained in the image, similar to the
2014-09-24 19:05:35 -04:00
introduction in a Wikipedia entry
2014-09-23 21:26:02 -04:00
2014-09-24 19:05:35 -04:00
* a selection of links to outside resources that help to describe the software
2014-09-23 21:26:02 -04:00
2014-09-24 19:05:35 -04:00
* a *mandatory* link to the `Dockerfile`
2014-09-08 19:30:39 -04:00
#### How-to/usage
2014-09-24 19:05:35 -04:00
2014-09-23 17:21:00 -04:00
A section that describes how to run and use the image, including common use
2014-09-24 19:05:35 -04:00
cases and example `Dockerfile` s (if applicable). Try to provide clear, step-by-
2014-09-23 17:21:00 -04:00
step instructions wherever possible.
2014-09-04 21:09:00 -04:00
2014-09-24 19:05:35 -04:00
##### Issues & contributions
2014-09-24 19:05:35 -04:00
In this section, point users to any resources that can help them contribute to
the project. Include contribution guidelines and any specific instructions
related to your development practices. Include a link to
2014-09-23 17:21:00 -04:00
[Docker’ s resources for contributors ](https://docs.docker.com/contributing/contributing/ ).
2014-09-04 21:09:00 -04:00
Be sure to include contact info, handles, etc. for official maintainers.
2014-09-24 19:05:35 -04:00
Also include information letting users know where they can go for help and how
2014-09-23 17:21:00 -04:00
they can file issues with the repo. Point them to any specific IRC channels,
issue trackers, contacts, additional “how-to” information or other resources.
2014-09-04 21:09:00 -04:00
2014-09-08 19:30:39 -04:00
### License
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
Include a file, `LICENSE` , of any applicable license. Docker recommends using
the license of the software contained in the image, provided it allows Docker,
2014-09-24 19:05:35 -04:00
Inc. to legally build and distribute the image. Otherwise, Docker recommends
adopting the [Expat license ](http://directory.fsf.org/wiki/License:Expat )
(a.k.a., the MIT or X11 license).
2014-09-04 21:09:00 -04:00
2014-09-08 19:30:39 -04:00
## Examples
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
Below are sample short and long description files for an imaginary image
containing Ruby on Rails.
2014-09-04 21:09:00 -04:00
2014-09-08 19:30:39 -04:00
### Short description
2014-09-08 14:43:09 -04:00
2014-09-08 17:59:16 -04:00
`README-short.txt`
`Ruby on Rails is an open-source application framework written in Ruby. It emphasizes best practices such as convention over configuration, active record pattern, and the model-view-controller pattern.`
2014-09-08 14:43:09 -04:00
2014-09-08 19:30:39 -04:00
### Long description
2014-09-08 14:43:09 -04:00
2014-09-08 17:59:16 -04:00
`README.md`
```markdown
# What is Ruby on Rails
Ruby on Rails, often simply referred to as Rails, is an open source web application framework which runs via the Ruby programming language. It is a full-stack framework: it allows creating pages and applications that gather information from the web server, talk to or query the database, and render templates out of the box. As a result, Rails features a routing system that is independent of the web server.
> [wikipedia.org/wiki/Ruby_on_Rails](https://en.wikipedia.org/wiki/Ruby_on_Rails)
# How to use this image
## Create a `Dockerfile` in your rails app project
2014-09-04 21:09:00 -04:00
FROM rails:onbuild
2014-09-08 17:59:16 -04:00
Put this file in the root of your app, next to the `Gemfile` .
This image includes multiple `ONBUILD` triggers so that should be all that you need for most applications. The build will `ADD . /usr/src/app` , `RUN bundle install` , `EXPOSE 3000` , and set the default command to `rails server` .
2014-09-24 19:05:35 -04:00
Then build and run the Docker image.
2014-09-08 17:59:16 -04:00
2014-09-08 14:43:09 -04:00
docker build -t my-rails-app .
docker run --name some-rails-app -d my-rails-app
2014-09-08 17:59:16 -04:00
Test it by visiting `http://container-ip:3000` in a browser. On the other hand, if you need access outside the host on port 8080:
2014-09-08 14:43:09 -04:00
docker run --name some-rails-app -p 8080:3000 -d my-rails-app
2014-09-08 17:59:16 -04:00
2014-09-24 19:05:35 -04:00
Then go to `http://localhost:8080` or `http://host-ip:8080` in a browser.
2014-09-08 17:59:16 -04:00
```
2014-09-04 21:09:00 -04:00
2014-09-23 17:21:00 -04:00
For more examples, take a look at these repos:
* [Go ](https://github.com/docker-library/golang )
* [PostgreSQL ](https://github.com/docker-library/postgres )
* [Buildpack-deps ](https://github.com/docker-library/buildpack-deps )
* ["Hello World" minimal container ](https://github.com/docker-library/hello-world )
* [Node ](https://github.com/docker-library/node )
2014-09-24 19:05:35 -04:00
## Submit your repo
2014-09-24 19:05:35 -04:00
Once you've checked off everything in these guidelines, and are confident your
image is ready for primetime, please contact us at
[partners@docker.com ](mailto:partners@docker.com ) to have your project
considered for the Official Repos program.