github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/docs/userguide/containers/dockerrepos.md (about)

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