# Day 5: Pull and Re-Tag a Docker Image
🎯 Objective
Pull the busybox:musl Docker image on App Server 1 and create a new tag for the same image:
busybox:mediaThis task covers two fundamental Docker image operations:
🧠 Concept
Docker Image
A Docker image is a read-only template used to create containers.
Images are commonly identified using:
<repository>:<tag>For example:
busybox:muslHere:
Repository → busybox
Tag → muslThe tag usually identifies a particular version or variant of the image.
📥 Docker Pull
The docker pull command downloads an image from a container registry.
Syntax:
docker pull <image>:<tag>For this task:
docker pull busybox:muslDocker will download the musl variant of the BusyBox image from the configured registry.
🏷️ Docker Tag
The docker tag command creates another tag that references an existing Docker image.
Syntax:
docker tag <source-image>:<tag> <target-image>:<tag>For this task:
docker tag busybox:musl busybox:mediaThis does not create a completely new copy of the image.
Instead, both tags reference the same underlying local image:
Docker Image
│
┌───────┴───────┐
▼ ▼
busybox:musl busybox:media🚀 Step 1: Connect to App Server 1
SSH into App Server 1:
ssh <username>@<app-server-1>Make sure Docker is installed and running:
sudo systemctl status docker📥 Step 2: Pull the BusyBox Image
Pull the required image:
docker pull busybox:muslIf Docker requires root privileges:
sudo docker pull busybox:muslAfter completion, Docker should report that the image was downloaded successfully or is already up to date.
🔍 Step 3: Verify the Image
List the local Docker images:
docker imagesOr:
docker image lsYou should see something similar to:
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox musl abc123def456 ... ...You can filter specifically for BusyBox:
docker image ls busybox🏷️ Step 4: Create the New Tag
Create the media tag from busybox:musl:
docker tag busybox:musl busybox:mediaThe structure is:
docker tag
│
├── Source → busybox:musl
│
└── New Tag → busybox:media🔍 Step 5: Verify the New Tag
Check the images again:
docker image ls busyboxYou should now see both tags:
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox musl abc123def456 ... ...
busybox media abc123def456 ... ...Notice that both entries have the same IMAGE ID.
This confirms that:
busybox:musl
│
├── IMAGE ID: abc123def456
│
busybox:media
│
└── IMAGE ID: abc123def456Both tags point to the same underlying Docker image.
⚙️ Complete Commands
The entire task can be completed with:
docker pull busybox:musl
docker tag busybox:musl busybox:media
docker image ls busyboxIf sudo is required:
sudo docker pull busybox:musl
sudo docker tag busybox:musl busybox:media
sudo docker image ls busybox🧠 Image vs Tag
It is important to understand that a tag is not the image itself.
Consider:
busybox:musl
busybox:mediaAfter tagging:
busybox:musl ─────┐
├──→ Same Docker Image
busybox:media ────┘Creating a new tag is therefore very lightweight because Docker does not duplicate all of the image layers.
🗑️ Optional: Remove a Tag
If the new tag is no longer needed:
docker rmi busybox:mediaThis removes the media reference.
If busybox:musl still references the image, the underlying image data remains available.
⚠️ Important Notes
🧪 Validation Checklist
📌 Summary
The task requires two main Docker commands:
1. Pull the image
docker pull busybox:musl2. Create the new tag
docker tag busybox:musl busybox:mediaThen verify:
docker image ls busyboxThe final state should be:
Docker Registry
│
│ docker pull
▼
busybox:musl
│
│ docker tag
▼
┌─────────────────────────┐
│ Local Docker Image │
│ │
│ busybox:musl │
│ busybox:media │
│ │ │
│ └─ Same Image │
└─────────────────────────┘The key takeaway is:
> docker pull retrieves an image, while docker tag creates another name/reference for that same image.