github.com/portworx/docker@v1.12.1/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_menu" 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 61 NAME DESCRIPTION STARS OFFICIAL AUTOMATED 62 centos The official build of CentOS 1223 [OK] 63 tianon/centos CentOS 5 and 6, created using rinse instea... 33 64 ... 65 66 There you can see two example results: `centos` and `tianon/centos`. The second 67 result shows that it comes from the public repository of a user, named 68 `tianon/`, while the first result, `centos`, doesn't explicitly list a 69 repository which means that it comes from the trusted top-level namespace for 70 [Official Repositories](https://docs.docker.com/docker-hub/official_repos/). The `/` character separates 71 a user's repository from the image name. 72 73 Once you've found the image you want, you can download it with `docker pull <imagename>`: 74 75 $ docker pull centos 76 77 Using default tag: latest 78 latest: Pulling from library/centos 79 f1b10cd84249: Pull complete 80 c852f6d61e65: Pull complete 81 7322fbe74aa5: Pull complete 82 Digest: sha256:90305c9112250c7e3746425477f1c4ef112b03b4abe78c612e092037bfecc3b7 83 Status: Downloaded newer image for centos:latest 84 85 You now have an image from which you can run containers. 86 87 ### Specific Versions or Latest 88 Using `docker pull centos` is equivalent to using `docker pull centos:latest`. 89 To pull an image that is not the default latest image you can be more precise 90 with the image that you want. 91 92 For example, to pull version 5 of `centos` use `docker pull centos:centos5`. 93 In this example, `centos5` is the tag labeling an image in the `centos` 94 repository for a version of `centos`. 95 96 To find a list of tags pointing to currently available versions of a repository 97 see the [Docker Hub](https://hub.docker.com) registry. 98 99 ## Contributing to Docker Hub 100 101 Anyone can pull public images from the [Docker Hub](https://hub.docker.com) 102 registry, but if you would like to share your own images, then you must 103 [register first](https://docs.docker.com/docker-hub/accounts). 104 105 ## Pushing a repository to Docker Hub 106 107 In order to push a repository to its registry, you need to have named an image 108 or committed your container to a named image as we saw 109 [here](dockerimages.md). 110 111 Now you can push this repository to the registry designated by its name or tag. 112 113 $ docker push yourname/newimage 114 115 The image will then be uploaded and available for use by your team-mates and/or the 116 community. 117 118 ## Features of Docker Hub 119 120 Let's take a closer look at some of the features of Docker Hub. You can find more 121 information [here](https://docs.docker.com/docker-hub/). 122 123 * Private repositories 124 * Organizations and teams 125 * Automated Builds 126 * Webhooks 127 128 ### Private repositories 129 130 Sometimes you have images you don't want to make public and share with 131 everyone. So Docker Hub allows you to have private repositories. You can 132 sign up for a plan [here](https://hub.docker.com/account/billing-plans/). 133 134 ### Organizations and teams 135 136 One of the useful aspects of private repositories is that you can share 137 them only with members of your organization or team. Docker Hub lets you 138 create organizations where you can collaborate with your colleagues and 139 manage private repositories. You can learn how to create and manage an organization 140 [here](https://hub.docker.com/organizations/). 141 142 ### Automated Builds 143 144 Automated Builds automate the building and updating of images from 145 [GitHub](https://www.github.com) or [Bitbucket](http://bitbucket.com), directly on Docker 146 Hub. It works by adding a commit hook to your selected GitHub or Bitbucket repository, 147 triggering a build and update when you push a commit. 148 149 #### To setup an Automated Build 150 151 1. Create a [Docker Hub account](https://hub.docker.com/) and login. 152 2. Link your GitHub or Bitbucket account on the ["Linked Accounts & Services"](https://hub.docker.com/account/authorized-services/) page. 153 3. Select "Create Automated Build" from the "Create" dropdown menu 154 4. Pick a GitHub or Bitbucket project that has a `Dockerfile` that you want to build. 155 5. Pick the branch you want to build (the default is the `master` branch). 156 6. Give the Automated Build a name. 157 7. Assign an optional Docker tag to the Build. 158 8. Specify where the `Dockerfile` is located. The default is `/`. 159 160 Once the Automated Build is configured it will automatically trigger a 161 build and, in a few minutes, you should see your new Automated Build on the [Docker Hub](https://hub.docker.com) 162 Registry. It will stay in sync with your GitHub and Bitbucket repository until you 163 deactivate the Automated Build. 164 165 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. 166 167 Once you've created an Automated Build you can deactivate or delete it. You 168 cannot, however, push to an Automated Build with the `docker push` command. 169 You can only manage it by committing code to your GitHub or Bitbucket 170 repository. 171 172 You can create multiple Automated Builds per repository and configure them 173 to point to specific `Dockerfile`'s or Git branches. 174 175 #### Build triggers 176 177 Automated Builds can also be triggered via a URL on Docker Hub. This 178 allows you to rebuild an Automated build image on demand. 179 180 ### Webhooks 181 182 Webhooks are attached to your repositories and allow you to trigger an 183 event when an image or updated image is pushed to the repository. With 184 a webhook you can specify a target URL and a JSON payload that will be 185 delivered when the image is pushed. 186 187 See the Docker Hub documentation for [more information on 188 webhooks](https://docs.docker.com/docker-hub/repos/#webhooks) 189 190 ## Next steps 191 192 Go and use Docker!