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:

root@debian:~# 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”):

root@debian:~# docker tag 12fe92cbee30 techstack/db 
root@debian:~# 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”:

root@debian:~# docker tag 174793a6cdeb techstack/confluence:new 

How Tagged Docker Images Look

This is much better now:

root@debian:/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

Contact Me

Follow me on Facebook, Twitter or Telegram:
I learn with Educative: Educative
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
24 Mar 2024

Homelab: Mac Pro 2013 32GB

30 Sep 2023

macOS Sonoma 14.0

26 Sep 2023

Video: What Browser Do You Use?

Recent Tweets