mirror of https://github.com/docker/docs.git
Revised and fixed links on dockerrepo.md
Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
This commit is contained in:
parent
98ea12ac38
commit
c70fbae3ed
|
@ -1,37 +1,49 @@
|
||||||
page_title: Working with Docker Hub
|
page_title: Working with Docker Hub
|
||||||
page_description: Learning how to use Docker Hub to manage images and work flow
|
page_description: Learn how to use the Docker Hub to manage Docker images and work flow
|
||||||
page_keywords: repo, Docker Hub, Docker Hub, registry, index, repositories, usage, pull image, push image, image, documentation
|
page_keywords: repo, Docker Hub, Docker Hub, registry, index, repositories, usage, pull image, push image, image, documentation
|
||||||
|
|
||||||
# Working with Docker Hub
|
# Working with Docker Hub
|
||||||
|
|
||||||
So far we've seen a lot about how to use Docker on the command line and
|
So far you've learned how to use the command line to run Docker on your local host.
|
||||||
your local host. We've seen [how to pull down
|
You've learned how to [pull down images](/userguide/usingdocker/) to build containers
|
||||||
images](/userguide/usingdocker/) that you can run your containers from
|
from existing images and you've learned how to [create your own images](/userguide/dockerimages).
|
||||||
and we've seen how to [create your own images](/userguide/dockerimages).
|
|
||||||
|
|
||||||
Now we're going to learn a bit more about
|
Next, you're going to learn how to use the [Docker Hub](https://hub.docker.com) to
|
||||||
[Docker Hub](https://hub.docker.com) and how you can use it to enhance
|
simplify and enhance your Docker workflows.
|
||||||
your Docker work flows.
|
|
||||||
|
|
||||||
[Docker Hub](https://hub.docker.com) is the public registry that Docker
|
The [Docker Hub](https://hub.docker.com) is a public registry maintained by Docker,
|
||||||
Inc maintains. It contains a huge collection of images, over 15,000,
|
Inc. It contains over 15,000 images you can download and use to build containers. It also
|
||||||
that you can download and use to build your containers. It also provides
|
provides authentication, work group structure, workflow tools like webhooks and build
|
||||||
authentication, structure (you can setup teams and organizations), work
|
triggers, and privacy tools like private repositories for storing images you don't want
|
||||||
flow tools like webhooks and build triggers as well as privacy features
|
to share publicly.
|
||||||
like private repositories for storing images you don't want to publicly
|
|
||||||
share.
|
|
||||||
|
|
||||||
## Docker commands and Docker Hub
|
## Docker commands and Docker Hub
|
||||||
|
|
||||||
Docker acts as a client for these services via the `docker search`,
|
Docker itself provides access to Docker Hub services via the `docker search`,
|
||||||
`pull`, `login` and `push` commands.
|
`pull`, `login`, and `push` commands. This page will show you how these commands work.
|
||||||
|
|
||||||
|
### Account creation and login
|
||||||
|
Typically, you'll want to start by creating an account on Docker Hub (if you haven't
|
||||||
|
already) and logging in. You can create your account directly on
|
||||||
|
[Docker Hub](https://hub.docker.com/account/signup/), or by running:
|
||||||
|
|
||||||
|
$ sudo docker login
|
||||||
|
|
||||||
|
This will prompt you for a user name, which will become the public namespace for your
|
||||||
|
public repositories.
|
||||||
|
If your user name is available, Docker will prompt you to enter a password and your
|
||||||
|
e-mail address. It will then automatically log you in. You can now commit and
|
||||||
|
push your own images up to your repos on Docker Hub.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> Your authentication credentials will be stored in the [`.dockercfg`
|
||||||
|
> authentication file](#authentication-file) in your home directory.
|
||||||
|
|
||||||
## Searching for images
|
## Searching for images
|
||||||
|
|
||||||
As we've already seen we can search the
|
You can search the [Docker Hub](https://hub.docker.com) registry via it's search
|
||||||
[Docker Hub](https://hub.docker.com) registry via it's search interface
|
interface or by using the command line interface. Searching can find images by image
|
||||||
or using the command line interface. Searching can find images by name,
|
name, user name, or description:
|
||||||
user name or description:
|
|
||||||
|
|
||||||
$ sudo docker search centos
|
$ sudo docker search centos
|
||||||
NAME DESCRIPTION STARS OFFICIAL TRUSTED
|
NAME DESCRIPTION STARS OFFICIAL TRUSTED
|
||||||
|
@ -41,12 +53,12 @@ user name or description:
|
||||||
|
|
||||||
There you can see two example results: `centos` and
|
There you can see two example results: `centos` and
|
||||||
`tianon/centos`. The second result shows that it comes from
|
`tianon/centos`. The second result shows that it comes from
|
||||||
the public repository of a user, `tianon/`, while the first result,
|
the public repository of a user, named `tianon/`, while the first result,
|
||||||
`centos`, doesn't explicitly list a repository so it comes from the
|
`centos`, doesn't explicitly list a repository which means that it comes from the
|
||||||
trusted top-level namespace. The `/` character separates a user's
|
trusted top-level namespace. The `/` character separates a user's
|
||||||
repository and the image name.
|
repository from the image name.
|
||||||
|
|
||||||
Once you have found the image you want, you can download it:
|
Once you've found the image you want, you can download it with `docker pull <imagename>`:
|
||||||
|
|
||||||
$ sudo docker pull centos
|
$ sudo docker pull centos
|
||||||
Pulling repository centos
|
Pulling repository centos
|
||||||
|
@ -55,84 +67,63 @@ Once you have found the image you want, you can download it:
|
||||||
511136ea3c5a: Download complete
|
511136ea3c5a: Download complete
|
||||||
7064731afe90: Download complete
|
7064731afe90: Download complete
|
||||||
|
|
||||||
The image is now available to run a container from.
|
You now have an image from which you can run containers.
|
||||||
|
|
||||||
## Contributing to Docker Hub
|
## Contributing to Docker Hub
|
||||||
|
|
||||||
Anyone can pull public images from the [Docker Hub](https://hub.docker.com)
|
Anyone can pull public images from the [Docker Hub](https://hub.docker.com)
|
||||||
registry, but if you would like to share your own images, then you must
|
registry, but if you would like to share your own images, then you must
|
||||||
register a user first as we saw in the [first section of the Docker User
|
register first, as we saw in the [first section of the Docker User
|
||||||
Guide](/userguide/dockerhub/).
|
Guide](/userguide/dockerhub/).
|
||||||
|
|
||||||
To refresh your memory, you can create your user name and login to
|
|
||||||
[Docker Hub](https://hub.docker.com/account/signup/), or by running:
|
|
||||||
|
|
||||||
$ sudo docker login
|
|
||||||
|
|
||||||
This will prompt you for a user name, which will become a public
|
|
||||||
namespace for your public repositories, for example:
|
|
||||||
|
|
||||||
training/webapp
|
|
||||||
|
|
||||||
Here `training` is the user name and `webapp` is a repository owned by
|
|
||||||
that user.
|
|
||||||
|
|
||||||
If your user name is available then `docker` will also prompt you to
|
|
||||||
enter a password and your e-mail address. It will then automatically log
|
|
||||||
you in. Now you're ready to commit and push your own images!
|
|
||||||
|
|
||||||
> **Note:**
|
|
||||||
> Your authentication credentials will be stored in the [`.dockercfg`
|
|
||||||
> authentication file](#authentication-file) in your home directory.
|
|
||||||
|
|
||||||
## Pushing a repository to Docker Hub
|
## Pushing a repository to Docker Hub
|
||||||
|
|
||||||
In order to push an repository to its registry you need to have named an image,
|
In order to push a repository to its registry, you need to have named an image
|
||||||
or committed your container to a named image as we saw
|
or committed your container to a named image as we saw
|
||||||
[here](/userguide/dockerimages).
|
[here](/userguide/dockerimages).
|
||||||
|
|
||||||
Now you can push this repository to the registry designated by its name
|
Now you can push this repository to the registry designated by its name or tag.
|
||||||
or tag.
|
|
||||||
|
|
||||||
$ sudo docker push yourname/newimage
|
$ sudo docker push yourname/newimage
|
||||||
|
|
||||||
The image will then be uploaded and available for use.
|
The image will then be uploaded and available for use by your team-mates and/or the
|
||||||
|
community.
|
||||||
|
|
||||||
## Features of Docker Hub
|
## Features of Docker Hub
|
||||||
|
|
||||||
Now let's look at some of the features of Docker Hub. You can find more
|
Let's take a closer look at some of the features of Docker Hub. You can find more
|
||||||
information [here](/docker-io/).
|
information [here](http://docs.docker.com/docker-hub/).
|
||||||
|
|
||||||
* Private repositories
|
* Private repositories
|
||||||
* Organizations and teams
|
* Organizations and teams
|
||||||
* Automated Builds
|
* Automated Builds
|
||||||
* Webhooks
|
* Webhooks
|
||||||
|
|
||||||
## Private Repositories
|
### Private Repositories
|
||||||
|
|
||||||
Sometimes you have images you don't want to make public and share with
|
Sometimes you have images you don't want to make public and share with
|
||||||
everyone. So Docker Hub allows you to have private repositories. You can
|
everyone. So Docker Hub allows you to have private repositories. You can
|
||||||
sign up for a plan [here](https://registry.hub.docker.com/plans/).
|
sign up for a plan [here](https://registry.hub.docker.com/plans/).
|
||||||
|
|
||||||
## Organizations and teams
|
### Organizations and teams
|
||||||
|
|
||||||
One of the useful aspects of private repositories is that you can share
|
One of the useful aspects of private repositories is that you can share
|
||||||
them only with members of your organization or team. Docker Hub lets you
|
them only with members of your organization or team. Docker Hub lets you
|
||||||
create organizations where you can collaborate with your colleagues and
|
create organizations where you can collaborate with your colleagues and
|
||||||
manage private repositories. You can create and manage an organization
|
manage private repositories. You can learn how to create and manage an organization
|
||||||
[here](https://registry.hub.docker.com/account/organizations/).
|
[here](https://registry.hub.docker.com/account/organizations/).
|
||||||
|
|
||||||
## Automated Builds
|
### Automated Builds
|
||||||
|
|
||||||
Automated Builds automate the building and updating of images from [GitHub](https://www.github.com)
|
Automated Builds automate the building and updating of images from
|
||||||
or [BitBucket](http://bitbucket.com), directly on Docker Hub. It works by adding a commit hook to
|
[GitHub](https://www.github.com) or [BitBucket](http://bitbucket.com), directly on Docker
|
||||||
your selected GitHub or BitBucket repository, triggering a build and update when you push a
|
Hub. It works by adding a commit hook to your selected GitHub or BitBucket repository,
|
||||||
commit.
|
triggering a build and update when you push a commit.
|
||||||
|
|
||||||
### To setup an Automated Build
|
#### To setup an Automated Build
|
||||||
|
|
||||||
1. Create a [Docker Hub account](https://hub.docker.com/) and login.
|
1. Create a [Docker Hub account](https://hub.docker.com/) and login.
|
||||||
2. Link your GitHub or BitBucket account through the [`Link Accounts`](https://registry.hub.docker.com/account/accounts/) menu.
|
2. Link your GitHub or BitBucket account through the ["Link Accounts"](https://registry.hub.docker.com/account/accounts/) menu.
|
||||||
3. [Configure an Automated Build](https://registry.hub.docker.com/builds/).
|
3. [Configure an Automated Build](https://registry.hub.docker.com/builds/).
|
||||||
4. Pick a GitHub or BitBucket project that has a `Dockerfile` that you want to build.
|
4. Pick a GitHub or BitBucket project that has a `Dockerfile` that you want to build.
|
||||||
5. Pick the branch you want to build (the default is the `master` branch).
|
5. Pick the branch you want to build (the default is the `master` branch).
|
||||||
|
@ -141,33 +132,32 @@ commit.
|
||||||
8. Specify where the `Dockerfile` is located. The default is `/`.
|
8. Specify where the `Dockerfile` is located. The default is `/`.
|
||||||
|
|
||||||
Once the Automated Build is configured it will automatically trigger a
|
Once the Automated Build is configured it will automatically trigger a
|
||||||
build, and in a few minutes, if there are no errors, you will see your
|
build and, in a few minutes, you should see your new Automated Build on the [Docker Hub](https://hub.docker.com)
|
||||||
new Automated Build on the [Docker Hub](https://hub.docker.com) Registry.
|
Registry. It will stay in sync with your GitHub and BitBucket repository until you
|
||||||
It will stay in sync with your GitHub and BitBucket repository until you
|
|
||||||
deactivate the Automated Build.
|
deactivate the Automated Build.
|
||||||
|
|
||||||
If you want to see the status of your Automated Builds you can go to your
|
If you want to see the status of your Automated Builds, you can go to your
|
||||||
[Automated Builds page](https://registry.hub.docker.com/builds/) on the Docker Hub,
|
[Automated Builds page](https://registry.hub.docker.com/builds/) on the Docker Hub,
|
||||||
and it will show you the status of your builds, and the build history.
|
and it will show you the status of your builds and their build history.
|
||||||
|
|
||||||
Once you've created an Automated Build you can deactivate or delete it. You
|
Once you've created an Automated Build you can deactivate or delete it. You
|
||||||
cannot however push to an Automated Build with the `docker push` command.
|
cannot, however, push to an Automated Build with the `docker push` command.
|
||||||
You can only manage it by committing code to your GitHub or BitBucket
|
You can only manage it by committing code to your GitHub or BitBucket
|
||||||
repository.
|
repository.
|
||||||
|
|
||||||
You can create multiple Automated Builds per repository and configure them
|
You can create multiple Automated Builds per repository and configure them
|
||||||
to point to specific `Dockerfile`'s or Git branches.
|
to point to specific `Dockerfile`'s or Git branches.
|
||||||
|
|
||||||
### Build Triggers
|
#### Build Triggers
|
||||||
|
|
||||||
Automated Builds can also be triggered via a URL on Docker Hub. This
|
Automated Builds can also be triggered via a URL on Docker Hub. This
|
||||||
allows you to rebuild an Automated build image on demand.
|
allows you to rebuild an Automated build image on demand.
|
||||||
|
|
||||||
## Webhooks
|
### Webhooks
|
||||||
|
|
||||||
Webhooks are attached to your repositories and allow you to trigger an
|
Webhooks are attached to your repositories and allow you to trigger an
|
||||||
event when an image or updated image is pushed to the repository. With
|
event when an image or updated image is pushed to the repository. With
|
||||||
a webhook you can specify a target URL and a JSON payload will be
|
a webhook you can specify a target URL and a JSON payload that will be
|
||||||
delivered when the image is pushed.
|
delivered when the image is pushed.
|
||||||
|
|
||||||
## Next steps
|
## Next steps
|
||||||
|
|
Loading…
Reference in New Issue