|
| 1 | +FROM docker.io/library/ubuntu:23.04 |
| 2 | + |
| 3 | +LABEL com.github.containers.toolbox="true" \ |
| 4 | + name="ubuntu-toolbox" \ |
| 5 | + version="23.04" \ |
| 6 | + usage="This image is meant to be used with the toolbox command" \ |
| 7 | + summary="Base image for creating Ubuntu toolbox containers" \ |
| 8 | + maintainer= "Ievgen Popovych <[email protected]>" |
| 9 | + |
| 10 | +# Remove apt configuration optimized for containers |
| 11 | +# Remove docker-gzip-indexes to help with "command-not-found" |
| 12 | +RUN rm /etc/apt/apt.conf.d/docker-gzip-indexes /etc/apt/apt.conf.d/docker-no-languages |
| 13 | + |
| 14 | +# Enable myhostname nss plugin for clean hostname resolution without patching |
| 15 | +# hosts (at least for sudo), add it right after 'files' entry. We expect that |
| 16 | +# this entry is not present yet. Do this early so that package postinst (which |
| 17 | +# adds it too late in the order) skips this step |
| 18 | +RUN sed -Ei 's/^(hosts:.*)(\<files\>)\s*(.*)/\1\2 myhostname \3/' /etc/nsswitch.conf |
| 19 | + |
| 20 | +# Restore documentation but do not upgrade all packages |
| 21 | +# Install ubuntu-minimal & ubuntu-standard |
| 22 | +# Install extra packages as well as libnss-myhostname |
| 23 | +COPY extra-packages / |
| 24 | +RUN sed -Ei '/apt-get (update|upgrade)/s/^/#/' /usr/local/sbin/unminimize && \ |
| 25 | + apt-get update && \ |
| 26 | + yes | /usr/local/sbin/unminimize && \ |
| 27 | + DEBIAN_FRONTEND=noninteractive apt-get -y install \ |
| 28 | + ubuntu-minimal ubuntu-standard \ |
| 29 | + libnss-myhostname \ |
| 30 | + flatpak-xdg-utils \ |
| 31 | + $(cat extra-packages | xargs) && \ |
| 32 | + rm -rd /var/lib/apt/lists/* |
| 33 | +RUN rm /extra-packages |
| 34 | + |
| 35 | +# Fix empty bind-mount to clear selinuxfs (see #337) |
| 36 | +RUN mkdir /usr/share/empty |
| 37 | + |
| 38 | +# Add flatpak-spawn to /usr/bin |
| 39 | +RUN ln -s /usr/libexec/flatpak-xdg-utils/flatpak-spawn /usr/bin/ |
| 40 | + |
| 41 | +# Having anything in /home prevents toolbox from symlinking /var/home there, |
| 42 | +# and 'ubuntu' user with UID 1000 will most likely conflict with host user as well |
| 43 | +RUN userdel --remove ubuntu |
| 44 | + |
| 45 | +# Disable APT ESM hook which tries to enable some systemd services on each apt invocation |
| 46 | +RUN rm /etc/apt/apt.conf.d/20apt-esm-hook.conf |
0 commit comments