Home > Article > Operation and Maintenance > How to upload docker image files to DockerHub
How to upload the docker image file to DockerHub?
1. Create a new repository in Docker Hub
Register and log in to Docker Hub
, click on the upper right corner Create Repository
, create a repository, as shown in the figure below:
Give it a name, such as demo. And you can choose whether it is a public or private repository.
2. Build the docker image file
Enter the path where the Dockerfile file is located, and the format of the built image file is as follows.
-t参数用来指定 image 文件的名字; username为你的Docker Hub用户名; repository为你新建的存储库名称;
tag is the version number;
The last dot indicates the path where the Dockerfile file is located. This is the current path, so it is a dot.
$ docker image build -t [username]/[repository]:[tag] .
My command to build the image file is as follows:
$ docker image build -t 01/demo:0.0.1 .
3. Push the image to Docker Hub
Local loginDocker Hub
, enter the following command locally:
$ docker login
Then enter the user name and password to log in.
After successful login, push the Docker image to Docker Hub. Enter the following command:
$ docker push lihui01/demo:0.0.1
Wait for a while and the upload will be successful.
4. View the pushed image in Docker Hub
Related references: docker tutorial
The above is the detailed content of How to upload docker image files to DockerHub. For more information, please follow other related articles on the PHP Chinese website!