outline
Docker push command
docker push command tutorial
The docker push command is used to upload the local Docker image to the Docker image repository .
Before using the docker push command, you need to log in to the mirror warehouse. The specification for pushing images by the docker push command is: registered user name/image name.
docker push command syntax
haicoder(www.haicoder.net)# docker push [OPTIONS] NAME[:TAG]
docker push command parameters
parameter | describe |
---|---|
docker push --disable-content-trust | Ignore the verification of the image, which is enabled by default. |
the case
Push local image
First, we use the docker pull command to pull a centos image.
haicoder(www.haicoder.net)# docker pull centos
After the pull is successful, we use the docker images command to view the pulled image, and the terminal displays the following:
First, we use the docker login command to log in to Docker Hub.
haicoder(www.haicoder.net)# docker longin -u XXXX -p XXXX
Enter the correct user name and password. After successful login, the terminal will display as shown in the following figure:
Now we use the docker run command to run the centos image we just pulled.
haicoder(www.haicoder.net)# docker run -it --name haicoder centos
#输出
[root@c55d93905f7c /]#
We install the vim command in the centos container.
[root@c55d93905f7c /]# yum install -y vim
The installation is successful, and the terminal displays the following:
Now, we exit the container, and make a tag on the host machine where we have just installed the vim command.
[root@c55d93905f7c /]# exit
exit
haicoder(www.haicoder.net)# docker tag docker.io/centos haicoder/centos-vim
Use the docker images command to view all current images, and the terminal displays the following:
Use the docekr push command on the host to push the image after installing vim to Docker Hub.
haicoder(www.haicoder.net)# docker push haicoder/centos-vim
After the push is successful, the terminal displays as shown in the following figure:
Use the docker rmi command to remove all images.
haicoder(www.haicoder.net)# docker rmi `docker images -q`
Summary of docker push command
The docker push command is used to upload the local image to the mirror warehouse.
You need to log in to the mirror warehouse before using the docker push command. The specification for pushing images with the docker push command is: registered user name/image name.
docker push command syntax:
docker push [OPTIONS] NAME[:TAG]