Docker Repository
# Docker Repository Management
A repository is a centralized place for storing images. The following introduces (https://hub.docker.com/). Of course, it's not just Docker Hub; the remote service provider is different, but the operations are the same.
## Docker Hub
Currently, Docker officially maintains a public repository (https://hub.docker.com/).
Most needs can be met by directly downloading images from Docker Hub.
### Registration
Register a free Docker account at [https://hub.docker.com](https://hub.docker.com/).
### Login and Logout
Login requires entering a username and password. After a successful login, you can pull all images under your account from Docker Hub.
$ docker login[!(#)](#)
**Logout**
To logout from Docker Hub, you can use the following command:
$ docker logout Pulling Images
You can search for images in the official repository using the `docker search` command and download them locally using the `docker pull` command.
Search using "ubuntu" as the keyword:
$ docker search ubuntu[!(#)](#)
Use `docker pull` to download the official ubuntu image locally:
$ docker pull ubuntu [!(#)](#)
### Pushing Images
After a user logs in, they can push their own images to Docker Hub using the `docker push` command.
In the following commands, please 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
YouTip