Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #102: Tracing a Docker Image's Dockerfile

docker-tips-and-tricks.jpg

This can help you debug issues such as something changing over time due to not pinning or digesting your images.

Prefer video? Here’s a recorded version of this tip on YouTube which covers this topic.

You can generalize these steps for any Docker image. Here’s an example of applying them to help find the latest version of composer that uses PHP 8.3.X instead of 8.4.X:

  1. Find the image on the Docker Hub (composer)
  2. Click the tag for the image you’re using (2)
  3. Find the base image it is using (php)
  4. Find the original image’s tag on the Docker Hub (composer:2)
  5. Check its base image (php) layer to see relevent details (ENV PHP_VERSION=8.4.3)
  6. Repeat steps 4 + 5 with a more specific image tag (2.8.4, 2.8.3, etc.)
  7. Finish when step 4 has the relevent details you want (ENV PHP_VERSION=8.3.13)

Pinning your images and using digests help prevent images from changing over time.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.



Comments