gnuradio / pybombs-docker

Dockerfiles for running PyBOMBS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

apt issues

draeath opened this issue · comments

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:

  1. docker creates the 'RUN apt-cache' layer
  2. the repository changes
  3. docker proceeds with subsequent apt installs (there may or may not have been a significant amount of time between the initial layer and now).
  4. apt tries to utilize invalid metadata

TL;DR these lines should be adjusted to read like this, or similar:

RUN DEBIAN_FRONTEND=noninteractive apt-get update -q &&\
    DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip python-apt

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:

  1. 'apt-get clean' after apt operations (must chain them as I discuss earlier)
  2. manually clean up the cache
  3. (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.

Looks like this is done for Debian and something similar for Ubuntu, so the apt clean part isn't necessary.

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.