Now we have the container running locally. We have created an image in the repository called mycustomimage with the tag v1.0.0, as you can see if you run the following:
docker images
The following screenshot shows the output of the preceding command:
To publish the image to Docker Hub, we can create another repository with our Docker ID or we can simply tag the current image with the new name, as shown in the following code:
If you don't have a Docker ID, go to https://docs.docker.com/docker-id/ to get one.
docker build --tag Docker-ID/mycustomimage:v1.0.0 .
We can also use the following:
docker tag mycustomimage:v1.0.0 Docker-ID/mycustomimage:v1.0.0
At this point, we can log into Docker Hub and push the image:
docker login --username Docker-ID
docker push Docker-ID/mycustomimage:v1.0.0