docker: Avoid error messages on container restarts

When the user restarts an already existing kas container, errors are
thrown because of existing folders or users. One example is the usage
of gitlab-ci runners.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2017-11-21 18:21:40 +01:00 committed by Daniel Wagner
parent 7aff26d105
commit cd076101f4

View File

@ -15,7 +15,7 @@ USER_ID=${USER_ID:-30000}
if [ $USER_ID == 0 ]; then if [ $USER_ID == 0 ]; then
# We shall run everything as root # We shall run everything as root
mkdir /builder mkdir -p /builder
cd /builder cd /builder
if [ -n "$1" ]; then if [ -n "$1" ]; then
@ -24,8 +24,10 @@ if [ $USER_ID == 0 ]; then
exec bash exec bash
fi fi
else else
# Create a non-root user that will perform the actual build if ! id $USER_ID >/dev/null 2>&1; then
useradd --uid $USER_ID --create-home --home-dir /builder builder # Create a non-root user that will perform the actual build
useradd --uid $USER_ID --create-home --home-dir /builder builder
fi
cd /builder cd /builder
if [ -n "$1" ]; then if [ -n "$1" ]; then