Docker Tip #102: Tracing a Docker Image's Dockerfile
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:
- Find the image on the Docker Hub (composer)
- Click the tag for the image you’re using (2)
- Find the base image it is using (php)
- Find the original image’s tag on the Docker Hub (composer:2)
- Check its base image (php) layer to see relevent details (
ENV PHP_VERSION=8.4.3
) - Repeat steps 4 + 5 with a more specific image tag (2.8.4, 2.8.3, etc.)
- 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.