How to push a local Docker Image to Docker Hub
- This post assumes you have Docker installed and running on your local machine, if that is not the case follow the steps outlined here for your respective OS.
- This post assumes you have already built the image locally.
The steps required to push your first Docker image to Docker Hub:
- Login to or signup for Docker on their website.
- Create an empty repository on the website. The only thing required here is a name for the repository. Make sure it is public, which it will be by default. Follow this link for more details.
- Login to docker on the command line
docker login
using the same credentials as the website. - Find the local image you want to push to Docker Hub through the command
docker image ls
. - Tag the Docker image, which is the equivalent to staging it for release:
<!-- template -->
docker tag local-image:local-tag-name docker-username/empty-repo-name:tag-name
<!-- example -->
docker tag k8s-test-app:latest joe-britton/first-repo:v.0.0.1
- Check that the tag was created through the command
docker image ls
. - Push the image to Docker Hub through the command
docker push joe-britton/first-repo:v.0.0.1
- Revisit the repository you created on Dockers website and you should see your image.