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
As each RUN statement causes a new image layer (which can be cached), when using yum/apt commands one should chain the commands in the same RUN statement. Otherwise, there is a chance of cache consistency issues. Eg:
docker creates the 'RUN apt-cache' layer
the repository changes
docker proceeds with subsequent apt installs (there may or may not have been a significant amount of time between the initial layer and now).
apt tries to utilize invalid metadata
TL;DR these lines should be adjusted to read like this, or similar:
This will cause the apt work to be 'atomic.' You are correct in specifying DEBIAN_FRONTEND within the RUN instead of as an ENV as well, as the ENV would cause it's propagation to container runtime.
Another issue - apt can and will leave items behind in it's cache, bloating the generated images unless care is taken to clean them.
Options:
'apt-get clean' after apt operations (must chain them as I discuss earlier)
manually clean up the cache
(best choice) configure apt not to cache at all. a working example of this configuration can be seen here.
FINAL NOTE: you might consider using one of the buildpack-deps dockerhub images instead of using the base ubuntu image, because it will ship some of the common build dependencies "out of the box" making for a quicker build. This may result in a larger image however, as not all of these dependencies may actually be required.
The text was updated successfully, but these errors were encountered:
Looks like you can also perform this command to reconfigure debconf to use the noninteractive frontend by default: echo "set debconf/frontend noninteractive" | DEBIAN_FRONTEND=noninteractive debconf-communicate (the variable is defined here as otherwise, debconf spams the error while you turn it off)
It may be desirable to set it back at the end of the build, so interactive calls get a frontend.
Reference these lines
As each RUN statement causes a new image layer (which can be cached), when using yum/apt commands one should chain the commands in the same RUN statement. Otherwise, there is a chance of cache consistency issues. Eg:
TL;DR these lines should be adjusted to read like this, or similar:
This will cause the apt work to be 'atomic.' You are correct in specifying DEBIAN_FRONTEND within the RUN instead of as an ENV as well, as the ENV would cause it's propagation to container runtime.
Another issue - apt can and will leave items behind in it's cache, bloating the generated images unless care is taken to clean them.
Options:
FINAL NOTE: you might consider using one of the buildpack-deps dockerhub images instead of using the base ubuntu image, because it will ship some of the common build dependencies "out of the box" making for a quicker build. This may result in a larger image however, as not all of these dependencies may actually be required.
The text was updated successfully, but these errors were encountered: