Docker Repository Management
A repository (Repository) is a centralized place for storing images. Let's introduce Docker Hub. Of course, there are other remote service providers, but the operations are the same.
Docker Hub
Currently, Docker maintains a public repository, Docker Hub.
Most requirements can be met by directly downloading images from Docker Hub.
Registration
Register for a free Docker account at https://hub.docker.com.
Login and Logout
Login requires your username and password. After successful login, you can pull all images under your account from Docker Hub.
$ docker login
Logout
To logout from Docker Hub, use the following command:
$ docker logout
You can search for images in the official repository using the docker search
command and download them to your local machine using the docker pull
command.
Search with the keyword "ubuntu":
$ docker search ubuntu
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.
Replace username
with your Docker account username in the following commands.
$ 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