I want to set the default acl for some folders when building a docker image using setfacl but it has no effect. The default acl is unchanged. My aim is that every file that is created in /opt must have rwX permissions for any user, as the image will be run with an arbitrary uid later and needs full access to /opt.
Here's a quick example Dockerfile
FROM ubuntu:bionic
SHELL ["/bin/bash", "-c"]
RUN apt-get update > /dev/null && apt-get install -y --no-install-recommends acl > /dev/null
RUN chmod -R a+rwXs /opt
RUN setfacl -d -m o::rwx /opt
RUN getfacl /opt
and the output is
# file: opt
# owner: root
# group: root
# flags: ss-
user::rwx
group::rwx
other::rwx
which is wrong, the default acl is missing. But if I run the commands in the container manually it works
docker run -ti --rm ubuntu:bionic bash
root@636bf8fdba41:/# apt-get update > /dev/null && apt-get install -y --no-install-recommends acl > /dev/null
debconf: delaying package configuration, since apt-utils is not installed
root@636bf8fdba41:/# chmod -R a+rwXs /opt
root@636bf8fdba41:/# setfacl -d -m o::rwx /opt
root@636bf8fdba41:/# getfacl /opt
getfacl: Removing leading '/' from absolute path names
# file: opt
# owner: root
# group: root
# flags: ss-
user::rwx
group::rwx
other::rwx
default:user::rwx
default:group::rwx
default:other::rwx
Any idea why docker does not correctly apply the acl changes when running setfacl in the Dockerfile?
Docker version 19.03.5, build 633a0ea838 Ubuntu 18.04 as host
umask 0000
. Example:RUN printf '#!/bin/sh\numask 0000\n/bin/sh -c "$*"' | sudo tee /bin/umasksh && sudo chmod +x /bin/umasksh SHELL ["/bin/umasksh"] RUN mkdir some_dir # umask 0000 will be called before mkdir
– Sibie