Bird
Raised Fist0
Dockerdevops~5 mins

Image tags and versioning in Docker - Cheat Sheet & Quick Revision

Choose your learning style10 modes available
Recall & Review
beginner
What is a Docker image tag?
A Docker image tag is a label that identifies a specific version of a Docker image. It helps you choose which version of the image to use when running containers.
Click to reveal answer
beginner
Why should you use version tags instead of the 'latest' tag?
Using version tags ensures you run a specific, tested image version. The 'latest' tag can change over time, which might cause unexpected behavior or bugs.
Click to reveal answer
beginner
How do you specify a tag when pulling a Docker image?
You add a colon and the tag name after the image name. For example: docker pull ubuntu:22.04 pulls the Ubuntu image tagged '22.04'.
Click to reveal answer
beginner
What happens if you don't specify a tag when pulling a Docker image?
Docker uses the 'latest' tag by default, which means it pulls the image tagged as 'latest'. This might not always be the version you want.
Click to reveal answer
intermediate
How can you tag a local Docker image with a new version?
Use the command docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]. For example, docker tag myapp:1.0 myapp:1.1 creates a new tag '1.1' for the same image.
Click to reveal answer
What does the Docker tag 'latest' mean?
AIt is a tag you must always specify manually
BIt always points to the oldest image version
CIt is a special tag that deletes images
DIt is the default tag if none is specified
How do you pull a specific version of an image named 'nginx' tagged '1.23'?
Adocker pull nginx:1.23
Bdocker pull nginx-1.23
Cdocker pull nginx/latest
Ddocker pull nginx
Why is it risky to always use the 'latest' tag in production?
ABecause 'latest' images are always unstable
BBecause 'latest' might change and cause unexpected bugs
CBecause 'latest' deletes old images automatically
DBecause 'latest' is not supported by Docker
How do you add a new tag '2.0' to an existing local image 'myapp:1.0'?
Adocker build myapp:2.0
Bdocker pull myapp:2.0
Cdocker tag myapp:1.0 myapp:2.0
Ddocker push myapp:2.0
What is the correct format to specify an image with a tag?
Aimage_name:tag
Bimage_name/tag
Cimage_name#tag
Dimage_name@tag
Explain why using specific version tags for Docker images is important in software deployment.
Think about what happens if your app suddenly uses a different image version without warning.
You got /4 concepts.
    Describe how to tag a Docker image locally and why you might want to do this.
    Tagging is like giving a nickname to a photo so you can find it easily later.
    You got /4 concepts.

      Practice

      (1/5)
      1. What is the default tag used by Docker if no tag is specified when pulling an image?
      easy
      A. stable
      B. 1.0
      C. latest
      D. default

      Solution

      1. Step 1: Understand Docker image tagging

        Docker images can have tags to specify versions or variants.
      2. Step 2: Identify the default tag behavior

        If no tag is specified, Docker uses the tag named "latest" by default.
      3. Final Answer:

        latest -> Option C
      4. Quick Check:

        Default tag = latest [OK]
      Hint: No tag means Docker uses 'latest' automatically [OK]
      Common Mistakes:
      • Assuming 'stable' is default tag
      • Thinking '1.0' is default version
      • Believing 'default' is a valid tag
      2. Which of the following is the correct syntax to pull a Docker image with a specific tag?
      easy
      A. docker pull ubuntu:20.04
      B. docker pull ubuntu-20.04
      C. docker pull ubuntu/20.04
      D. docker pull ubuntu#20.04

      Solution

      1. Step 1: Recall Docker image tag syntax

        The correct syntax to specify a tag is image_name:tag.
      2. Step 2: Match syntax with options

        Only docker pull ubuntu:20.04 uses a colon to separate image name and tag correctly.
      3. Final Answer:

        docker pull ubuntu:20.04 -> Option A
      4. Quick Check:

        Use colon ':' to specify tag [OK]
      Hint: Use ':' between image name and tag [OK]
      Common Mistakes:
      • Using dash '-' instead of colon ':'
      • Using slash '/' instead of colon
      • Using hash '#' instead of colon
      3. Given the command docker pull nginx:1.21, what will be the result?
      medium
      A. Docker throws an error due to invalid tag
      B. Docker pulls the latest nginx image ignoring 1.21
      C. Docker pulls all nginx images
      D. Docker pulls the nginx image tagged 1.21

      Solution

      1. Step 1: Analyze the pull command with tag

        The command specifies the image name 'nginx' and tag '1.21'.
      2. Step 2: Understand Docker pull behavior

        Docker pulls the exact image version matching the tag '1.21'.
      3. Final Answer:

        Docker pulls the nginx image tagged 1.21 -> Option D
      4. Quick Check:

        Tag specifies exact image version [OK]
      Hint: Tag pulls specific image version, not latest [OK]
      Common Mistakes:
      • Assuming tag is ignored and latest is pulled
      • Expecting error for valid tag
      • Thinking all images are pulled
      4. You run docker pull alpine and get an error that the image is not found. What is the most likely cause?
      medium
      A. You forgot to specify the tag, and 'latest' tag is missing
      B. The image 'alpine' does not exist on Docker Hub
      C. Docker requires a tag to pull any image
      D. Your internet connection is down

      Solution

      1. Step 1: Understand default tag behavior

        When no tag is specified, Docker tries to pull the 'latest' tag.
      2. Step 2: Identify cause of error

        If the 'latest' tag does not exist for 'alpine', Docker cannot find the image.
      3. Final Answer:

        You forgot to specify the tag, and 'latest' tag is missing -> Option A
      4. Quick Check:

        Missing 'latest' tag causes pull failure [OK]
      Hint: Always specify tag if 'latest' is missing [OK]
      Common Mistakes:
      • Assuming image does not exist at all
      • Thinking tag is always required
      • Blaming internet without checking tags
      5. You want to deploy a Docker image but ensure you always use version 2.5.3, never the latest. Which command correctly pulls this specific version and avoids accidental updates?
      hard
      A. docker pull myapp:stable
      B. docker pull myapp:2.5.3
      C. docker pull myapp:latest
      D. docker pull myapp

      Solution

      1. Step 1: Understand version control with tags

        Using a specific tag like '2.5.3' ensures you get that exact version.
      2. Step 2: Compare options for safety

        docker pull myapp:2.5.3 pulls the exact version. Options B and C pull 'latest' which can change. docker pull myapp:stable depends on tag existence.
      3. Final Answer:

        docker pull myapp:2.5.3 -> Option B
      4. Quick Check:

        Explicit version tag prevents accidental updates [OK]
      Hint: Always specify exact version tag to avoid surprises [OK]
      Common Mistakes:
      • Using 'latest' tag and getting unexpected updates
      • Assuming 'stable' tag always exists
      • Not specifying any tag and risking version changes
      Recommended

      Ready to prove it?

      Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

      10 questions~5 mineasy hard