Add docker_user and password args to Dockerfile

Symlinking /etc/passwd files leads to invalid cross-device link errors
when running apt commands.

Internally, apt uses dpkg, which adds a user "irc" when performing apt
installs/upgrades.  This subprocess leads to the error.

The solution implemented here creates a user with the same name and id
as the current user.  This gives both users the the same file permissions,
without having to symlink /etc/passwd.
This commit is contained in:
John Colvin committed 2021-10-10 14:20:07 -04:00
1 parent fc316243c2
commit f1d398ba81
2 files changed
+14 -1

No files matched your search

+6
View File
@@ -231,3 +231,9 @@ RUN \
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove -y
########################
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
+8 -1
View File
@@ -1 +1,8 @@
docker build -t bluetradingsystems/linux_docker .
#!/usr/bin/env bash
docker build \
--build-arg docker_user=$USER \
--build-arg docker_user_id=$(id -u) \
--build-arg docker_password=$USER \
-t spark-crypto_18.04 \
.