From e90ba67a4ccdd7d81eea7547b79dada61d99824c Mon Sep 17 00:00:00 2001 From: Andras Fekete Date: Mon, 16 Jan 2023 13:32:10 -0500 Subject: [PATCH] Fix when a base image leaves non-root user --- Docker/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index b55ba7964..8740588bb 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -1,11 +1,13 @@ ARG DOCKER_BASE_IMAGE=ubuntu:22.04 FROM $DOCKER_BASE_IMAGE +USER root + RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y build-essential autoconf libtool git gdb iputils-ping ARG USER=docker ARG UID=1000 ARG GID=1000 -RUN groupadd -f -g ${GID} docker && useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID} +RUN groupadd -f -g ${GID} docker && ( getent passwd ${UID} || useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID} ) USER ${UID}:${GID} \ No newline at end of file