Nautilus project developers are planning to start testing on a new project. As per their meeting with the DevOps team, they want to test containerized environment application features. As per details shared with DevOps team, we need to accomplish the following task:
a. Pull busybox:musl image on App Server 2 in Stratos DC and re-tag (create new tag) this image as busybox:news.
Step-by-Step Instructions
1. SSH into Application Server 2
ssh steve@stapp02
Password: Am3ric@
2. Switch to root or use sudo
sudo su -
or prefix all commands with sudo
3. Pull the Docker image
Pull the busybox:musl image from Docker Hub:
sudo docker pull busybox:musl
4. Verify the image was pulled successfully
sudo docker images | grep busybox
Or specifically:
sudo docker images busybox:musl
5. Retag the image
Create a new tag busybox:news for the existing image:
sudo docker tag busybox:musl busybox:news
6. Verify the new tag was created
sudo docker images | grep busybox
You should see both busybox:musl and busybox:news with the same IMAGE ID.
7. Confirm both tags point to the same image (optional)
# Get image ID of original
sudo docker images busybox:musl -q
# Get image ID of new tag
sudo docker images busybox:news -q
# Both should show the same ID
Complete Execution Summary
# SSH to App Server 2
ssh steve@stapp02
# Switch to root
sudo su -
# Pull the image
docker pull busybox:musl
# Verify pull
docker images busybox:musl
# Retag the image
docker tag busybox:musl busybox:news
# Verify both tags
docker images | grep busybox
# Confirm same image ID
echo "Original ID: $(docker images busybox:musl -q)"
echo "New ID: $(docker images busybox:news -q)"
Verification Script
Run this to verify everything is correct:
echo "=== Pulling busybox:musl image ==="
docker pull busybox:musl
echo -e "\n=== Verifying image was pulled ==="
docker images busybox:musl
echo -e "\n=== Retagging as busybox:news ==="
docker tag busybox:musl busybox:news
echo -e "\n=== All busybox images ==="
docker images | grep busybox
echo -e "\n=== Comparing image IDs ==="
ORIGINAL_ID=$(docker images busybox:musl -q)
NEW_ID=$(docker images busybox:news -q)
if [ "$ORIGINAL_ID" = "$NEW_ID" ]; then
echo "✅ Both tags point to the same image ID: $ORIGINAL_ID"
echo "✅ Task completed successfully!"
else
echo "❌ Image IDs do not match!"
fi
echo -e "\n=== Full image details ==="
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.Size}}" | grep busybox
Important Notes
- Retagging does NOT create a new image; it just adds another tag to the same image
- The image ID remains the same for both tags
- Both tags refer to the same underlying layers
- This is useful for versioning or creating aliases for images
Understanding BusyBox
BusyBox is a software suite that provides several stripped-down Unix tools in a single executable file. It's commonly used in minimal Docker images.
-
busybox:musluses the musl libc (a lightweight C standard library) -
busybox:glibcuses the glibc (GNU C library) -
busybox:latesttypically uses glibc
If You Want to Remove the Original Tag (Optional)
After retagging, you can keep both tags or remove the original:
# Remove the original tag (only if you want to)
docker rmi busybox:musl
# Note: This only removes the tag, not the image
# The image remains as long as it has at least one tag (busybox:news)
Quick One-Liner
sudo docker pull busybox:musl && sudo docker tag busybox:musl busybox:news && sudo docker images | grep busybox
Troubleshooting
If the image fails to pull:
# Check Docker daemon status
systemctl status docker
# Check network connectivity
ping -c 3 registry-1.docker.io
# Try pulling with verbose output
docker pull busybox:musl --debug
If you get a permission error:
# Use sudo
sudo docker pull busybox:musl
sudo docker tag busybox:musl busybox:news
If the tag already exists and you want to overwrite:
Docker automatically overwrites existing tags, so just run the command again.
To see all tags for an image:
docker images --filter=reference='busybox:*'
Top comments (0)