github.com/kobeld/docker@v1.12.0-rc1/docs/tutorials/dockerrepos.md (about)

     1  <!--[metadata]>
     2  +++
     3  aliases = [
     4  "/engine/userguide/containers/dockerrepos/",
     5  "/engine/userguide/dockerrepos/"
     6  ]
     7  title = "Store images on Docker Hub"
     8  description = "Learn how to use the Docker Hub to manage Docker images and work flow"
     9  keywords = ["repo, Docker Hub, Docker Hub, registry, index, repositories, usage, pull image, push image, image,  documentation"]
    10  [menu.main]
    11  parent = "engine_learn"
    12  +++
    13  <![end-metadata]-->
    14  
    15  # Store images on Docker Hub
    16  
    17  So far you've learned how to use the command line to run Docker on your local
    18  host. You've learned how to [pull down images](usingdocker.md) to build
    19  containers from existing images and you've learned how to [create your own
    20  images](dockerimages.md).
    21  
    22  Next, you're going to learn how to use the [Docker Hub](https://hub.docker.com)
    23  to simplify and enhance your Docker workflows.
    24  
    25  The [Docker Hub](https://hub.docker.com) is a public registry maintained by
    26  Docker, Inc. It contains images you can download and use to build
    27  containers. It also provides authentication, work group structure, workflow
    28  tools like webhooks and build triggers, and privacy tools like private
    29  repositories for storing images you don't want to share publicly.
    30  
    31  ## Docker commands and Docker Hub
    32  
    33  Docker itself provides access to Docker Hub services via the `docker search`,
    34  `pull`, `login`, and `push` commands. This page will show you how these commands work.
    35  
    36  ### Account creation and login
    37  Before you try an Engine CLI command, if you haven't already, create a Docker
    38  ID. You can do this through [Docker Hub](https://hub.docker.com/). Once you have
    39  a Docker ID, log into your account from the Engine CLI:
    40  
    41  ```bash
    42  $ docker login
    43  ```
    44  
    45  The `login` command stores your Docker ID authentication credentials in the
    46  `$HOME/.docker/config.json` (Bash notation). For Windows `cmd` users the
    47  notation for this file is `%HOME%\.docker\config.json` ; for PowerShell users
    48  the notation is `$env:Home\.docker\config.json`.
    49  
    50  Once you have logged in from the command line, you can `commit` and `push`
    51  Engine subcommands to interact with your repos on Docker Hub.
    52  
    53  ## Searching for images
    54  
    55  You can search the [Docker Hub](https://hub.docker.com) registry via its search
    56  interface or by using the command line interface. Searching can find images by image
    57  name, user name, or description:
    58  
    59      $ docker search centos
    60      NAME           DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
    61      centos         The official build of CentOS                    1223      [OK]
    62      tianon/centos  CentOS 5 and 6, created using rinse instea...   33
    63      ...
    64  
    65  There you can see two example results: `centos` and `tianon/centos`. The second
    66  result shows that it comes from the public repository of a user, named
    67  `tianon/`, while the first result, `centos`, doesn't explicitly list a
    68  repository which means that it comes from the trusted top-level namespace for
    69  [Official Repositories](https://docs.docker.com/docker-hub/official_repos/). The `/` character separates
    70  a user's repository from the image name.
    71  
    72  Once you've found the image you want, you can download it with `docker pull <imagename>`:
    73  
    74      $ docker pull centos
    75      Using default tag: latest
    76      latest: Pulling from library/centos
    77      f1b10cd84249: Pull complete
    78      c852f6d61e65: Pull complete
    79      7322fbe74aa5: Pull complete
    80      Digest: sha256:90305c9112250c7e3746425477f1c4ef112b03b4abe78c612e092037bfecc3b7
    81      Status: Downloaded newer image for centos:latest
    82  
    83  You now have an image from which you can run containers.
    84  
    85  ### Specific Versions or Latest
    86  Using `docker pull centos` is equivalent to using `docker pull centos:latest`.
    87  To pull an image that is not the default latest image you can be more precise
    88  with the image that you want.
    89  
    90  For example, to pull version 5 of `centos` use `docker pull centos:centos5`.
    91  In this example, `centos5` is the tag labeling an image in the `centos`
    92  repository for a version of `centos`.
    93  
    94  To find a list of tags pointing to currently available versions of a repository
    95  see the [Docker Hub](https://hub.docker.com) registry.
    96  
    97  ## Contributing to Docker Hub
    98  
    99  Anyone can pull public images from the [Docker Hub](https://hub.docker.com)
   100  registry, but if you would like to share your own images, then you must
   101  [register first](https://docs.docker.com/docker-hub/accounts).
   102  
   103  ## Pushing a repository to Docker Hub
   104  
   105  In order to push a repository to its registry, you need to have named an image
   106  or committed your container to a named image as we saw
   107  [here](dockerimages.md).
   108  
   109  Now you can push this repository to the registry designated by its name or tag.
   110  
   111      $ docker push yourname/newimage
   112  
   113  The image will then be uploaded and available for use by your team-mates and/or the
   114  community.
   115  
   116  ## Features of Docker Hub
   117  
   118  Let's take a closer look at some of the features of Docker Hub. You can find more
   119  information [here](https://docs.docker.com/docker-hub/).
   120  
   121  * Private repositories
   122  * Organizations and teams
   123  * Automated Builds
   124  * Webhooks
   125  
   126  ### Private repositories
   127  
   128  Sometimes you have images you don't want to make public and share with
   129  everyone. So Docker Hub allows you to have private repositories. You can
   130  sign up for a plan [here](https://hub.docker.com/account/billing-plans/).
   131  
   132  ### Organizations and teams
   133  
   134  One of the useful aspects of private repositories is that you can share
   135  them only with members of your organization or team. Docker Hub lets you
   136  create organizations where you can collaborate with your colleagues and
   137  manage private repositories. You can learn how to create and manage an organization
   138  [here](https://hub.docker.com/organizations/).
   139  
   140  ### Automated Builds
   141  
   142  Automated Builds automate the building and updating of images from
   143  [GitHub](https://www.github.com) or [Bitbucket](http://bitbucket.com), directly on Docker
   144  Hub. It works by adding a commit hook to your selected GitHub or Bitbucket repository,
   145  triggering a build and update when you push a commit.
   146  
   147  #### To setup an Automated Build
   148  
   149  1.  Create a [Docker Hub account](https://hub.docker.com/) and login.
   150  2.  Link your GitHub or Bitbucket account on the ["Linked Accounts &amp; Services"](https://hub.docker.com/account/authorized-services/) page.
   151  3.  Select "Create Automated Build" from the "Create" dropdown menu
   152  4.  Pick a GitHub or Bitbucket project that has a `Dockerfile` that you want to build.
   153  5.  Pick the branch you want to build (the default is the `master` branch).
   154  6.  Give the Automated Build a name.
   155  7.  Assign an optional Docker tag to the Build.
   156  8.  Specify where the `Dockerfile` is located. The default is `/`.
   157  
   158  Once the Automated Build is configured it will automatically trigger a
   159  build and, in a few minutes, you should see your new Automated Build on the [Docker Hub](https://hub.docker.com)
   160  Registry. It will stay in sync with your GitHub and Bitbucket repository until you
   161  deactivate the Automated Build.
   162  
   163  To check the output and status of your Automated Build repositories, click on a repository name within the ["Your Repositories" page](https://registry.hub.docker.com/repos/). Automated Builds are indicated by a check-mark icon next to the repository name. Within the repository details page, you may click on the "Build Details" tab to view the status and output of all builds triggered by the Docker Hub.
   164  
   165  Once you've created an Automated Build you can deactivate or delete it. You
   166  cannot, however, push to an Automated Build with the `docker push` command.
   167  You can only manage it by committing code to your GitHub or Bitbucket
   168  repository.
   169  
   170  You can create multiple Automated Builds per repository and configure them
   171  to point to specific `Dockerfile`'s or Git branches.
   172  
   173  #### Build triggers
   174  
   175  Automated Builds can also be triggered via a URL on Docker Hub. This
   176  allows you to rebuild an Automated build image on demand.
   177  
   178  ### Webhooks
   179  
   180  Webhooks are attached to your repositories and allow you to trigger an
   181  event when an image or updated image is pushed to the repository. With
   182  a webhook you can specify a target URL and a JSON payload that will be
   183  delivered when the image is pushed.
   184  
   185  See the Docker Hub documentation for [more information on
   186  webhooks](https://docs.docker.com/docker-hub/repos/#webhooks)
   187  
   188  ## Next steps
   189  
   190  Go and use Docker!