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).
This commit is contained in:
1 parent
191d74b404
commit
42916b0142
1 file changed
+14
-4
+14
-4
@@ -296,10 +296,20 @@ RUN \
|
||||
########################
|
||||
|
||||
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
|
||||
useradd -m $docker_user \
|
||||
&& echo "${docker_user}:${docker_password}" | chpasswd \
|
||||
&& adduser $docker_user sudo
|
||||
|
||||
RUN USER=$docker_user && \
|
||||
GROUP=$docker_user && \
|
||||
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
|
||||
|
||||
USER $docker_user:$docker_user
|
||||
ENTRYPOINT [fixuid]
|
||||
Reference in new issue
Block a user