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