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