2 DL3017
T.K edited this page 2019-03-13 09:59:06 +09: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.

Do not use apk upgrade

Problematic code:

FROM alpine:3.7
RUN apk update \
    && apk upgrade \
    && apk add foo=1.0 \
    && rm -rf /var/cache/apk/*

Correct code:

FROM alpine:3.7
RUN apk --no-cache add foo=1.0

Rationale:

You should avoid RUN apk upgrade, as many of the “essential” packages from the parent images wont upgrade inside an unprivileged container. If a package contained in the parent image is out-of-date, you should contact its maintainers. If you know theres a particular package, foo, that needs to be updated, use apk --no-cache add foo to update automatically.

inspired by https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run