Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Docker Repository Management

Docker Repository Management

A repository (Repository) is a place where images are stored centrally. The following introduces Docker Hub. Of course it is not only Docker Hub; only the remote provider differs, the operations are all 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.

Registration

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

Log in and log out

Logging in requires a username and password. After a successful login, we can pull all images under our own account from Docker Hub.

$ docker login

Exit

To log out of Docker Hub, you can use the following command:

$ docker logout

Pulling Images

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

Search with ubuntu as the keyword:

$ docker search ubuntu

Use docker pull to download the official ubuntu image locally:

$ docker pull ubuntu 

Push an image

After logging in, users can push their own images to Docker Hub with the docker push command.

In the following commands, replace username 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