In the first two articles in this series, we have successfully run our application in Docker via Nginx and created an image in DockerFile.
- One of the Docker starter series: runs a specified Web application in a Docker container
- Docker Starter series 2: Using DockerFile to create an image containing a specified Web application
In this article we will show you how to publish this locally made image to docker Hub so that other Docker enthusiasts around the world can use your image.
First you need to register an account with docker Hub:
Then create a new repository to hold the Docker image. The operation is the same as creating the repository on Github.
The finished repository looks like this:
Docker ps get the current container ID:
Git commit: docker commit 53DE4188b702 i042416/ui5-nginx
Docker login Login to docker Hub:
Docker push local image to Docker Hub after successful login:
docker push i042416/ui5-nginx:latest
Copy the code
Get a successful push message:
After the push is successful, go to docker Hub to check the generated tag: Latest and image size: 45MB.
Docker run -it i042416/ui5-nginx:
Docker run automatically pulls the image from the Docker hub because the local image does not exist:
Docker run -d -p 1080:80 i042416/ui5-nginx
Then localhost:1080/webapp can access my Web application:
For more of Jerry’s original articles, please follow the public account “Wang Zixi “:
For more of Jerry’s original articles, please follow the public account “Wang Zixi “: