Docker Repository Management
Repository is a place where images are stored centrally. The following describes the Docker Hub. Of course there is more than docker hub, just the remote service provider is different, the operation is the same.
Docker Hub
Currently Docker maintains an official public repository Docker Hub.
Most of the requirements can be achieved by downloading images directly from Docker Hub.
Register
Register for a free Docker account at https://hub.docker.com.
Logging in and out
Once logged in, you need to enter your username and password. Once logged in successfully, we can pull all the mirrors under our account from docker hub.
$ docker login
Exit
Exiting docker hub can be done with the following command.
$ docker logout
Pulling mirrors
You can use the docker search command to find a mirror in the official repository and use the docker pull command to download it locally.
Search for ubuntu as the keyword.
$ docker search ubuntu
Use docker pull to download the official ubuntu image locally.
$ docker pull ubuntu
Push images
After logging in, users can push their images to Docker Hub with the docker push command.
Replace the username in the following command 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