Skip to content

Commit

Permalink
Fix uid not unique error when using root
Browse files Browse the repository at this point in the history
Signed-off-by: Woa <me@wuzy.com>
  • Loading branch information
ESWZY committed Jul 12, 2023
1 parent d81a192 commit f4a4242
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ createPersistentDockerDataVolume()
# shellcheck disable=SC2154
echo "Removing old volumes and containers"
# shellcheck disable=SC2046
${BUILD_CONFIG[DOCKER]} rm -f $(${BUILD_CONFIG[DOCKER]} ps -a --no-trunc -q -f volume="${BUILD_CONFIG[DOCKER_SOURCE_VOLUME_NAME]}") || true
local old_containers=$(${BUILD_CONFIG[DOCKER]} ps -a --no-trunc -q -f volume="${BUILD_CONFIG[DOCKER_SOURCE_VOLUME_NAME]}")
if [[ ${old_containers} != "" ]]; then
${BUILD_CONFIG[DOCKER]} rm -f $(old_containers) || true
else
echo "No old container was found"
fi
${BUILD_CONFIG[DOCKER]} volume rm -f "${BUILD_CONFIG[DOCKER_SOURCE_VOLUME_NAME]}" || true

# shellcheck disable=SC2154
Expand Down
2 changes: 1 addition & 1 deletion docker/dockerfile-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ printUserCreate(){
echo "
ARG HostUID
ENV HostUID=\$HostUID
RUN useradd -u \$HostUID -ms /bin/bash build
RUN useradd -o -u \$HostUID -ms /bin/bash build
WORKDIR /openjdk/build
RUN chown -R build /openjdk/
USER build" >> "$DOCKERFILE_PATH"
Expand Down

0 comments on commit f4a4242

Please sign in to comment.