From 226ccdfd9bcac1bac5674ebbbe13bcf9f2eaac0b Mon Sep 17 00:00:00 2001 From: John Colvin Date: Sun, 11 Sep 2022 00:57:53 -0400 Subject: [PATCH] Use fixuid to resolve user perm conflicts in mounted dirs It matches the user permissions in the container to those in the host. This has clear advantages to our previous solution, which matched the permissions in the image. One immediate benefit is that the jenkins server-build node can pull the image from Docker Hub, rather than build it on the host (for each build, to ensure the image is up-to-date). --- Dockerfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c95ae2..37f5be9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -295,11 +295,10 @@ RUN \ pkg-config ######################## -ARG docker_user -ARG docker_user_id -ARG docker_password - -RUN \ - useradd -u $docker_user_id -m $docker_user \ - && echo "${docker_user}:${docker_password}" \ - | chpasswd && adduser $docker_user sudo +RUN USER=docker && \ + GROUP=docker && \ + curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.5.1/fixuid-0.5.1-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \ + chown root:root /usr/local/bin/fixuid && \ + chmod 4755 /usr/local/bin/fixuid && \ + mkdir -p /etc/fixuid && \ + printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml