From 9f403d01850301011250cd129f1ec61d62e07169 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 27 Apr 2020 10:41:01 -0400 Subject: [PATCH] Fix permissions on containers.conf When running in a rootless buildah, the build user is not allowed to read /etc/containers/containers.conf which is causing these containers to fail. This patch makes containers.conf world readable. Signed-off-by: Daniel J Walsh --- contrib/buildahimage/stable/Dockerfile | 2 +- contrib/buildahimage/testing/Dockerfile | 2 +- contrib/buildahimage/upstream/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/buildahimage/stable/Dockerfile b/contrib/buildahimage/stable/Dockerfile index bf99a750c9d..950e98ba6bb 100644 --- a/contrib/buildahimage/stable/Dockerfile +++ b/contrib/buildahimage/stable/Dockerfile @@ -16,7 +16,7 @@ RUN useradd build; yum -y update; yum -y reinstall shadow-utils; yum -y install ADD https://raw.githubusercontent.com/containers/buildah/master/contrib/buildahimage/stable/containers.conf /etc/containers/ # Adjust storage.conf to enable Fuse storage. -RUN sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf +RUN chmod 644 /etc/containers/containers.conf; sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf RUN mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers; touch /var/lib/shared/overlay-images/images.lock; touch /var/lib/shared/overlay-layers/layers.lock # Set an environment variable to default to chroot isolation for RUN diff --git a/contrib/buildahimage/testing/Dockerfile b/contrib/buildahimage/testing/Dockerfile index f403f3f97a8..9b880c98f78 100644 --- a/contrib/buildahimage/testing/Dockerfile +++ b/contrib/buildahimage/testing/Dockerfile @@ -18,7 +18,7 @@ RUN useradd build; yum -y update; yum -y reinstall shadow-utils; yum -y install ADD https://raw.githubusercontent.com/containers/buildah/master/contrib/buildahimage/stable/containers.conf /etc/containers/ # Adjust storage.conf to enable Fuse storage. -RUN sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf +RUN chmod 644 /etc/containers/containers.conf; sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf RUN mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers; touch /var/lib/shared/overlay-images/images.lock; touch /var/lib/shared/overlay-layers/layers.lock # Set an environment variable to default to chroot isolation for RUN diff --git a/contrib/buildahimage/upstream/Dockerfile b/contrib/buildahimage/upstream/Dockerfile index cc503c881a2..e7bbe895716 100644 --- a/contrib/buildahimage/upstream/Dockerfile +++ b/contrib/buildahimage/upstream/Dockerfile @@ -46,7 +46,7 @@ RUN useradd build; yum -y update; yum -y reinstall shadow-utils; yum -y install ADD https://raw.githubusercontent.com/containers/buildah/master/contrib/buildahimage/stable/containers.conf /etc/containers/ # Adjust storage.conf to enable Fuse storage. -RUN sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf +RUN chmod 644 /etc/containers/containers.conf; sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf RUN mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers; touch /var/lib/shared/overlay-images/images.lock; touch /var/lib/shared/overlay-layers/layers.lock # Set an environment variable to default to chroot isolation for RUN