You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# we use libc6 instead of libc6-compat as we do not use alpine base image
ENV PACKAGES "unzip curl openssl ca-certificates git libc6 bash jq gettext"
# we also use apt-get as we use an Ubuntu image, not an Alpine
RUN apt-get update
&& apt-get -y upgrade
&& apt-get install -y --no-install-recommends ${PACKAGES}
&& rm -rf /var/lib/apt/lists/*
When building an image, Docker steps through the instructions in your Dockerfile, executing each in the order specified. As each instruction is examined, Docker looks for an existing image in its cache, rather than creating a new, duplicate image.
For the ADD and COPY instructions, the contents of each file in the image are examined and a checksum is calculated for each file. The last-modified and last-accessed times of each file aren’t considered in these checksums. During the cache lookup, the checksum is compared against the checksum in the existing images. If anything has changed in any file, such as the contents and metadata, then the cache is invalidated.
Below is a well-formed RUN instruction that demonstrates all the apt-get recommendations.
The s3cmd argument specifies a version 1.1.*. If the image previously used an older version, specifying the new one causes a cache bust of apt-get update and ensures the installation of the new version. Listing packages on each line can also prevent mistakes in package duplication.
In addition, when you clean up the apt cache by removing /var/lib/apt/lists it reduces the image size, since the apt cache isn’t stored in a layer. Since the RUN statement starts with apt-get update, the package cache is always refreshed prior to apt-get install.
Expected
See inspiration from
https://github.com/orange-cloudfoundry/paas-docker-cloudfoundry-tools/blob/30d5df749ff07e54719e79fc4acfaeb47e3b05cb/k8s-tools/Dockerfile#L14-L21
https://github.com/orange-cloudfoundry/paas-docker-cloudfoundry-tools/blob/30d5df749ff07e54719e79fc4acfaeb47e3b05cb/k8s-tools/Dockerfile#L3C3-L10
https://github.com/orange-cloudfoundry/paas-docker-cloudfoundry-tools/blob/30d5df749ff07e54719e79fc4acfaeb47e3b05cb/k8s-tools/Dockerfile#L6-L10
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache
/CC @o-orand
Observed
kuttl-enriched-image/Dockerfile
Lines 55 to 57 in c998037
/
The text was updated successfully, but these errors were encountered: