Always pin versions in apt-get install
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください。
ID: docker-best-practices/apt-pin-version
Language: Docker
Severity: Notice
Category: Best Practices
Description
When using apt-get install
, pin the version to avoid unwanted upgrades and undefined behavior.
Non-Compliant Code Examples
FROM debian:12
RUN set -eux; \
apt-get update; \
apt-get install -y curl git gcc g++ make cmake; \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
FROM debian:12
RUN apt-get install python
RUN apt-get update && \
apt-get install -y --no-install-recommends openjdk-19-jdk && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/ /var/cache/oracle*
Compliant Code Examples
FROM debian:12
RUN apt-get install python=3.11
Seamless integrations. Try Datadog Code Analysis