From 4516b3bf1839078c51369862bc20726c1ee7e4db Mon Sep 17 00:00:00 2001 From: Norbert Lange Date: Mon, 20 Mar 2023 13:20:17 +0100 Subject: [PATCH] Add user configuration to buildah container image The container has configuration for root, this commit adds a similar configuration for the build user. Closes: #4669 Signed-off-by: Norbert Lange --- contrib/buildahimage/Containerfile | 5 +++++ contrib/buildahimage/user-storage.conf | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 contrib/buildahimage/user-storage.conf diff --git a/contrib/buildahimage/Containerfile b/contrib/buildahimage/Containerfile index 26be7190570..93358722d9c 100644 --- a/contrib/buildahimage/Containerfile +++ b/contrib/buildahimage/Containerfile @@ -84,11 +84,16 @@ RUN mkdir -p /var/lib/shared/overlay-images \ touch /var/lib/shared/vfs-images/images.lock && \ touch /var/lib/shared/vfs-layers/layers.lock +ADD ./user-storage.conf /tmp/storage.conf + # Define uid/gid ranges for our user https://github.com/containers/buildah/issues/3053 RUN useradd build && \ echo -e "build:1:999\nbuild:1001:64535" > /etc/subuid && \ echo -e "build:1:999\nbuild:1001:64535" > /etc/subgid && \ mkdir -p /home/build/.local/share/containers && \ + mkdir -p /home/build/.config/containers && \ + mv /tmp/storage.conf /home/build/.config/containers/storage.conf && \ + chmod 700 /home/build/.config && \ chown -R build:build /home/build VOLUME /var/lib/containers diff --git a/contrib/buildahimage/user-storage.conf b/contrib/buildahimage/user-storage.conf new file mode 100644 index 00000000000..0003fec26f5 --- /dev/null +++ b/contrib/buildahimage/user-storage.conf @@ -0,0 +1,11 @@ +[storage] +driver = "overlay" + +[storage.options] +additionalimagestores = [ +"/var/lib/shared", +] + +[storage.options.overlay] +mount_program = "/usr/bin/fuse-overlayfs" +mountopt = "nodev,fsync=0"