How To Tag Docker Images

Docker Docker

I’m migrating a few Docker containers between hosts and realised that one step that always needs to happen to any image is tagging – this will save you confusion and time in the future.

YouTube video: How To Tag a Docker Image

Update 12/2020: I just published a video about the same topic, hope it helps you understand this topic even better:

pS: if you like the video, check out Unix Tutorial Videos section!

How Untagged Docker Images Look

Without tags, you just see the Docker Image IDs in the list – that’s the only identifier you can use for spinning up Docker containers based on such images:

[email protected]:~# docker images                                                                                                                                 REPOSITORY    TAG       IMAGE ID          CREATED           SIZE
                        174793a6cdeb      44 minutes ago    951MB
                        12fe92cbee30      44 minutes ago    367MB

How To Tag Docker Images

Although it’s called tagging, technically this process allows you to specify a repository for your Docker image – effectively giving the image a name. If you want to specify that this is one of the many images belonging to a particular group or vendor, use / delimited notation like this:


Where unixtutorial is a group or organisation (repository) and web-server is its subsection.

In my examples I’m using my consultancy codename – techstack: techstack/confluence for the wiki engine and techstack/db for my custom build of MariaDB.

Simply run the docker tag command, first parameter is the image ID and second is the repository (with optional tag, by default it will be tag called “latest”):

[email protected]:~# docker tag 12fe92cbee30 techstack/db 
[email protected]:~# docker tag 174793a6cdeb techstack/confluence

You can tag or rename the same image more than once: in this case I’m tagging the same image with repository name techstack/confluence and tag “new”:

[email protected]:~# docker tag 174793a6cdeb techstack/confluence:new 

How Tagged Docker Images Look

This is much better now:

[email protected]:/storage/docker # docker images
REPOSITORY             TAG       IMAGE ID        CREATED       SIZE
techstack/confluence   latest    174793a6cdeb    3 hours ago   951MB
techstack/confluence   new       174793a6cdeb    4 hours ago   951MB
techstack/db           latest    12fe92cbee30    3 hours ago   367MB

That’s it for today!

See Also

Keep Learning with Me

Follow me on Facebook and Twitter or jump into Telegram chat!:
Recommended Software
I use Brave browser, it's awesome: Brave Browser I'm also a fan of SetApp for macOS: SetApp for macOS
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
18 Jun 2021

CentOS 8.4 Released

17 Jun 2021

yum/dnf Package Manager Basics

07 Jun 2021


Recent Tweets