How to publish the image made by dockerfile to Docker hub
This article mainly introduces how to publish the image made by dockerfile to Docker hub, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
First, you have to register an account on docker hub:
Then create a new repository to hold the Docker image. The method of operation is the same as creating a code repository in Github.
The created warehouse looks like this:
Docker ps gets the ID of the current container:
Using docker commit submission, it works like the git commit that programmers are familiar with:
Docker commit 53de4188b702 i042416/ui5-nginx
Docker login login docker hub:
After logging in successfully, use docker push to push the local image to docker hub:
Docker push i042416/ui5-nginx:latest
Get the message of successful push:
After the push is successful, go to docker hub to view the generated tag:latest and image size: 45MB.
Go to another machine, docker run-it i042416/ui5-nginx:
From the output, you can see that because the local image does not exist, docker run automatically pull the image from the docker hub:
Then run with the command docker run-d-p 1080 80 i042416/ui5-nginx:
After that, localhost:1080/webapp can access my web application:
Thank you for reading this article carefully. I hope the article "how to publish the image made by dockerfile to Docker hub" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!