6 DL3008
Moritz Röhrich edited this page 2026-04-30 11:46:46 +02:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Pin versions in apt-get install.

Problematic code:

FROM busybox
RUN apt-get install python

Correct code:

FROM busybox
RUN apt-get install python=2.7.*

Rationale:

https://docs.docker.com/develop/develop-images/instructions/#apt-get

Version pinning forces the build to retrieve a particular version regardless of whats in the cache. This technique can also reduce failures due to unanticipated changes in required packages.

Additionally, software like Renovatebot can be used to keep pinned dependencies up to date. See e.g. https://docs.renovatebot.com/modules/datasource/deb/#usage-example