Skip to content

Commit 3ae977a

Browse files
committed
fix(dockerfile): set more lenient permissions on /home/runner
Currently, the permissions of /home/runner are 750. In some container runtimes and Kubernetes distributions (including OpenShift), a different uid/gid (not `runner`) may be used when running the image. The runner expects to be able to read and execute scripts within the home directory, and it will also write ephemeral files, diagnostic data, etc. into the directory as well. Therefore, to support the ability to use the runner as a user apart from `runner`, full 777 permissions are needed. A longer-term change to consider which may improve the security posture here would be to separate the executable portions of the application (scripts, etc.) from the places where temporary data is written, and control the permissions of these separately. Signed-off-by: Caleb Xu <[email protected]>
1 parent 0b2c71f commit 3ae977a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

images/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ RUN add-apt-repository ppa:git-core/ppa \
5454
&& apt install -y git \
5555
&& rm -rf /var/lib/apt/lists/*
5656

57+
WORKDIR /home/runner
58+
5759
RUN adduser --disabled-password --gecos "" --uid 1001 runner \
5860
&& groupadd docker --gid 123 \
5961
&& usermod -aG sudo runner \
6062
&& usermod -aG docker runner \
6163
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
62-
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers
63-
64-
WORKDIR /home/runner
64+
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers \
65+
&& chmod 777 /home/runner
6566

6667
COPY --chown=runner:docker --from=build /actions-runner .
6768
COPY --from=build /usr/local/lib/docker/cli-plugins/docker-buildx /usr/local/lib/docker/cli-plugins/docker-buildx

0 commit comments

Comments
 (0)