English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Docker Repository Management

Repository (Repository) is a place where images are stored centrally. The following introduces Docker Hub. Of course, it's not just Docker Hub; the remote service providers are different, but the operations are the same.

Docker Hub

Currently, Docker officially maintains a public repository Docker Hub.

Most needs can be met by directly downloading images from Docker Hub.

Register

In https://hub.docker.com Register a free Docker account.

Login and logout

Logging in requires entering a username and password. After successful login, we can pull all the images under our account from docker hub.

$ docker login

Logout

You can use the following command to logout of docker hub:

$ docker logout

Pull image

You can use the 'docker search' command to find official images in the repository and use the 'docker pull' command to download it locally.

Search with 'ubuntu' as the keyword:

$ docker search ubuntu

Use docker pull to download the official ubuntu image to your local machine:

$ docker pull ubuntu

Push Image

After logging in, you can push your own image to Docker Hub using the docker push command.

Please replace 'username' in the following commands with your Docker account username.

$ docker tag ubuntu:18.04 username/ubuntu:18.04
$ docker image ls
REPOSITORY      TAG        IMAGE ID            CREATED           ...  
ubuntu          18.04      275d79972a86        6 days ago        ...  
username/ubuntu 18.04      275d79972a86        6 days ago        ...  
$ docker push username/ubuntu:18.04
$ docker search username/ubuntu
NAME             DESCRIPTION       STARS         OFFICIAL    AUTOMATED
username/ubuntu