上QQ阅读APP看书,第一时间看更新
Uploading images to the Docker registry
Now we know how to search, pull, remove, save, load, and list available images. The last piece we are missing is how to push images back to Docker Hub or a private registry.
To upload an image to Docker Hub, we need to do a few tricks and follow these steps:
- Log in to Docker Hub:
$ docker login
Username: #Enter your username here
Password: #Enter your password here
Login Succeeded
- Copy the Docker image you want to push to a different path in the Docker repository on your server:
$ docker tag httpd:latest flashdumper/httpd:latest
Note that flashdumper is your Docker Hub username.
- Finally, push the copied image back to Docker Hub:
$ docker push flashdumper/httpd:latest
The output of the preceding command will be as shown in the following screenshot:
Now the image is pushed to your Docker Hub and available for anyone to download.
$ docker search flashdumper/*
The output of the preceding command will be as shown in the following screenshot:
You can check the same result using a web browser. If you go to https://hub.docker.com/ you should be able to see this httpd image available under your account:
Docker Hub account images