Docker learning notes – push image to registrys warehouse

Time:2020-11-25

The previous section demonstrated linking through the nginx reverse broker docker container:Docker learning notes 1 – deploy the. Net core 3.1 project to the docker container and use nginx reverse proxy (centos7) (2)

This section demonstrates how to push the packaged project image files created locally to the official image repository,

FirstDocker HubRegister account number. After registration, execute the command in the terminal

docker login

After successful login, as shown in the figure above!

How to create a new image file has been demonstrated before. Here, create a new image file

docker build -t 1312958948/ myapidemo:1.0 .      --Format of image file: account name / image name

Generally, the format of the image file is as follows:Account name / image name: version numberFor example: 1312958948/ myapidemo:1.0

Execute the following command to mirror push

Docker push image name

Push successful!

At the same time, go to the warehouse center of the official website and see that the image created just now has been uploaded successfully!

When using it, pull it directly

docker pull 1312958948/myapidemo:1.0

Or directly execute the run command, and the service will pull it automatically

docker run --name=myapidemo1 -d -p 5000:80 1312958948/myapidemo:1.0