Docker Logo

Docker Reference: Docker Tag (Tagging Images)


Docker tag is helpful when you are trying to push a locally created image to Docker hub but the name of your Docker Hub image repository is different than the local version, example:

You might have a local image named: local/ubuntu:1.0

Now, every repository created in Docker Hub begins with your username, in this case we will use my nickname: salcoder

Your repository is essentially named salcoder/ubuntu:1.0 so as you can see the problem is that local should be salcoder instead, well, lets fix it!

Solution — docker tag

Docker provides a tool (docker tag)which will allow us to change the name of our local image so it can match with Docker Hub.

We type the following:

docker tag local/ubuntu:1.0 salcoder/ubuntu:1.0

Now, push:

docker push salcoder/ubuntu:1.0

Remember that :1.0 is the actual tag, you can name it latest or whatever else you like.

I hope this quick reference was helpful! Questions, suggestions are always appreciated!