Pin a base image so builds are reproducible and safe from tag changes.
AdvancedHands-onWrite-a-Dockerfile tasks
Answer
FROM python:3.12-slim@sha256:<digest-from-registry>
docker buildx imagetools inspect python:3.12-slim # shows the index digest
Key trick → Tags are mutable and digests are not. Let Renovate bump the digest through PRs so you still get security patches, but each change is reviewed and traceable.
More on Write-a-Dockerfile tasks
Write a production Dockerfile for a Node.js API using a multi-stage build.IntermediateWrite a Dockerfile for a Python Flask app that runs with gunicorn as a non-root user.BeginnerWrite a Dockerfile for a Go service that produces a tiny image (under 20 MB).IntermediateWrite a multi-stage Dockerfile for a Java Spring Boot app built with Maven.IntermediateWrite a Dockerfile for a static React site served by Nginx.BeginnerThis Dockerfile rebuilds dependencies on every code change. Fix it.Beginner