====== Docker - Images - Push an Image to the Docker Hub ======
**NOTE:** In order to work with the Docker Hub, you will need to create an account on [[https://hub.docker.com/account/signup|Docker Hub]].
===== Log in to the Docker Hub =====
docker login
returns:
Username: peter
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
----
===== Tag the Image to push to the Docker Hub =====
For example, to tag the nginx-instance image:
docker tag 12cefc9b5362 peter/nginx-instance:ubuntu
where:
* 12cefc9b5362 is the ID of the nginx-instance image.
* peter is your Docker Hub username.
* nginx-instance is the name of the image that you want to push.
----
===== Verify the Tagged Image =====
docker images
returns:
REPOSITORY TAG IMAGE ID CREATED SIZE
peter/nginx-instance ubuntu 12cefc9b5362 12 minutes ago 158MB
nginx-instance latest 12cefc9b5362 12 minutes ago 158MB
ubuntu 20.04 d70eaf7277ea 12 days ago 72.9MB
----
===== Push the new Image to the Docker Hub =====
Push the new image named peter/nginx-instance to the Docker Hub:
docker push peter/nginx-instance
----
===== Login to the Docker Hub =====
Login to the Docker Hub using your web browser and verify that the nginx-instance image appears in the Repositories.