Handle UID stuff

This commit is contained in:
Radon Rosborough 2020-06-05 19:31:11 -06:00
parent 9a9ab44755
commit f8b9e20cb8
3 changed files with 33 additions and 2 deletions

View File

@ -1,6 +1,13 @@
FROM ubuntu:rolling
COPY scripts/docker-install.bash /tmp/
RUN /tmp/docker-install.bash
ARG UID
COPY scripts/docker-install.bash /tmp/
RUN /tmp/docker-install.bash "$UID"
USER $UID
WORKDIR /home/docker
EXPOSE 6119
ENTRYPOINT ["/usr/local/bin/pid1.bash"]
COPY scripts/pid1.bash /usr/local/bin/

View File

@ -3,6 +3,13 @@
set -e
set -o pipefail
if (( $# != 1 )); then
echo "usage: docker-install.bash UID" >&2
exit 1
fi
uid="$1"
packages="
# Handy utilities
@ -38,4 +45,11 @@ apt-get update
apt-get install -y $(grep -v "^#" <<< "$packages")
rm -rf /var/lib/apt/lists/*
if (( "$uid" != 0 )); then
useradd --uid="$uid" --create-home --groups sudo docker
passwd -d docker
else
ln -s /root /home/docker
fi
rm "$0"

10
scripts/pid1.bash Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
set -o pipefail
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
export SHELL="$(which bash)"
exec "$@"