docker-tags-alpine-latest

What are Docker Tags

  • 5 min

A Docker tag is a label that identifies a variant of an image within the same repository.

When you visit Docker Hub looking for something as theoretically simple as Node.js or Python, you don’t find a single download button.

Instead, you’re faced with a huge list of options (node:latest, node:20, node:20-alpine, node:20-bookworm-slim…). Which one do I choose? What’s the difference? Is the lighter one better?

In this article, we’ll learn how to navigate the “Docker Supermarket” and understand the tagging system to always choose the best option for your project.

What is a Tag?

A Tag is simply a text string that identifies a specific version of an image. It is placed after the colon :.

image_name:tag
Copied!

If you don’t specify anything, Docker implicitly assumes :latest.

Image “Flavors”: Full, Slim, and Alpine

Besides the version number (18, 20), we often see suffixes that indicate the base operating system the image uses underneath.

Let’s compare them using Python as an example.

The standard version (e.g., python:3.10)

If you choose the tag that only has the version number, you are usually downloading an image based on “full” Debian.

  • Advantages: It has everything. Common libraries, system tools, compilers… It’s the most compatible. Almost anything you install will work.
  • Disadvantages: It’s heavy. It can easily take up 800MB - 1GB. Also, having so many things gives it a larger attack surface (security vulnerabilities).

The slim version (e.g., python:3.10-slim)

It is still based on Debian, but everything “superfluous” has been removed (man pages, documentation tools, non-essential compilers).

  • Advantages: Much lighter (about 150MB - 200MB). Maintains good compatibility because it’s still Debian.
  • Disadvantages: If you need to compile complex native libraries, you might be missing some tools and have to install them manually.

The alpine version (e.g., python:3.10-alpine)

With alpine we enter more delicate territory. Alpine Linux is a minimalist distribution designed to be very small.

  • Advantages: It’s ridiculously small (50MB!). It’s very secure and fast to transfer over the network.
  • Disadvantages: It does NOT use the standard C library (glibc) used by Ubuntu or Debian, but instead uses an alternative called musl.
  • This means that if your application uses libraries compiled in C (common in Python or Node), they might fail or you’ll have to recompile them from scratch, making the build process extremely slow.

To show you the real difference, look at the sizes of these Node.js images (approximate data):

TagBase OSSizeRecommendation
node:20Debian (Full)~1 GBDevelopment / Initial Testing
node:20-slimDebian (Trimmed)~200 MBProduction (Balanced)
node:20-alpineAlpine Linux~50 MBAdvanced Users / Microservices

Understanding the Weird Names (Bullseye, Bookworm…)

Sometimes you’ll see things like node:20-bullseye or node:20-bookworm. These names refer to the specific version of Debian underneath.

  • buster = Debian 10
  • bullseye = Debian 11
  • bookworm = Debian 12

Why is this useful? If you want to ensure maximum stability, you want to pin not just the Node version, but also the operating system version. Using node:20-bullseye ensures the base OS doesn’t change suddenly.

Which one should I choose?

  1. To start and learn: Use the standard version (python:3.10 or node:20). Don’t complicate your life optimizing megabytes right now. You want it to work.
  2. For Production (General): Use the -slim versions. They are the perfect balance between size and compatibility. They rarely cause problems.
  3. For Experts / Go / Rust: If you use languages that compile to a static binary (like Go) or have tight control over dependencies, use Alpine. Saving those 100MB makes a difference if you have 50 microservices.
  4. For Python/Data Science: Beware of Alpine! Many data science libraries (Pandas, Numpy) suffer on Alpine. Here, slim is better.

The docker tag command

The docker tag command is used to assign a new tag to an existing image. It does not create a new image, but simply associates a new tag with the same underlying image.

The syntax of the docker tag command is as follows:

docker tag SOURCE_IMAGE NEW_TAG
Copied!

Where:

  • SOURCE_IMAGE: Is the existing image you want to tag. It can be the image ID or its current name and tag.
  • NEW_TAG: Is the new name and tag you want to assign.