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