31z4 / zookeeper-docker

Docker image packaging for Apache Zookeeper
MIT License
285 stars 244 forks source link

3.7.2 build failure in docker official images #166

Closed yosifkit closed 4 months ago

yosifkit commented 4 months ago

Describe the bug zookeeper:3.7.2 is failing to (re)build in Docker Official Images after the parent image was updated.

To Reproduce Because the library/zookeeper file is still pointing at https://github.com/31z4/zookeeper-docker/commit/dd520cb108da9eafe6914dce4e5dbd4877dd2411 for 3.7.2 (https://github.com/docker-library/official-images/blob/6c99e13a4748dae454be260479d9a2ed51cd6c38/library/zookeeper#L5-L7), the 3.7.2 image now fails to build because the parent eclipse-temurin:11-jre has moved to Ubuntu Noble which has an ubuntu user at 1000 by default now (https://github.com/docker-library/official-images/pull/17231#issuecomment-2245772484).

$ docker buildx build --progress=plain --build-arg BUILDKIT_DOCKERFILE_CHECK=skip=all https://github.com/31z4/zookeeper-docker.git#dd520cb108da9eafe6914dce4e5dbd4877dd2411:3.7.2
#0 building with "default" instance using docker driver

#1 [internal] load git source https://github.com/31z4/zookeeper-docker.git#dd520cb108da9eafe6914dce4e5dbd4877dd2411:3.7.2
#1 0.015 Initialized empty Git repository in /var/lib/docker/overlay2/1m7emz1w7ozvkbzfugdr588oc/diff/
#1 0.018 fatal: Not a valid object name dd520cb108da9eafe6914dce4e5dbd4877dd2411^{commit}
#1 0.662 From https://github.com/31z4/zookeeper-docker
#1 0.662  * [new branch]      master     -> origin/master
#1 DONE 0.7s

#2 [internal] load metadata for docker.io/library/eclipse-temurin:11-jre
#2 DONE 1.3s

#3 [1/6] FROM docker.io/library/eclipse-temurin:11-jre@sha256:54d24c1a113881b2051548283e6dd8779c9974d910a524eca4e5e6fe5adb4b61
#3 resolve docker.io/library/eclipse-temurin:11-jre@sha256:54d24c1a113881b2051548283e6dd8779c9974d910a524eca4e5e6fe5adb4b61 done
...
#3 DONE 2.5s

#4 [2/6] RUN set -eux;     groupadd -r zookeeper --gid=1000;     useradd -r -g zookeeper --uid=1000 zookeeper;     mkdir -p "/datalog" "/data" "/conf" "/logs";     chown zookeeper:zookeeper "/datalog" "/data" "/conf" "/logs"
#4 0.177 + groupadd -r zookeeper --gid=1000
#4 0.178 groupadd: GID '1000' already exists
#4 ERROR: process "/bin/sh -c set -eux;     groupadd -r zookeeper --gid=1000;     useradd -r -g zookeeper --uid=1000 zookeeper;     mkdir -p \"$ZOO_DATA_LOG_DIR\" \"$ZOO_DATA_DIR\" \"$ZOO_CONF_DIR\" \"$ZOO_LOG_DIR\";     chown zookeeper:zookeeper \"$ZOO_DATA_LOG_DIR\" \"$ZOO_DATA_DIR\" \"$ZOO_CONF_DIR\" \"$ZOO_LOG_DIR\"" did not complete successfully: exit code: 4
------
 > [2/6] RUN set -eux;     groupadd -r zookeeper --gid=1000;     useradd -r -g zookeeper --uid=1000 zookeeper;     mkdir -p "/datalog" "/data" "/conf" "/logs";     chown zookeeper:zookeeper "/datalog" "/data" "/conf" "/logs":
0.177 + groupadd -r zookeeper --gid=1000
0.178 groupadd: GID '1000' already exists
------
Dockerfile:17
--------------------
  16 |     # Add a user with an explicit UID/GID and create necessary directories
  17 | >>> RUN set -eux; \
  18 | >>>     groupadd -r zookeeper --gid=1000; \
  19 | >>>     useradd -r -g zookeeper --uid=1000 zookeeper; \
  20 | >>>     mkdir -p "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" "$ZOO_LOG_DIR"; \
  21 | >>>     chown zookeeper:zookeeper "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" "$ZOO_LOG_DIR"
  22 |
--------------------
ERROR: failed to solve: process "/bin/sh -c set -eux;     groupadd -r zookeeper --gid=1000;     useradd -r -g zookeeper --uid=1000 zookeeper;     mkdir -p \"$ZOO_DATA_LOG_DIR\" \"$ZOO_DATA_DIR\" \"$ZOO_CONF_DIR\" \"$ZOO_LOG_DIR\";     chown zookeeper:zookeeper \"$ZOO_DATA_LOG_DIR\" \"$ZOO_DATA_DIR\" \"$ZOO_CONF_DIR\" \"$ZOO_LOG_DIR\"" did not complete successfully: exit code: 4

Expected behavior docker build finishes and creates an image.

System configuration

docker version cli: 27.0.3, server: 27.0.2 though it shouldn't matter too much as long as it is relatively up to date.

Additional context I think official images just needs the updated commit for 3.7.2 though I am not sure if you also wanted the jre17 bump or not (https://github.com/31z4/zookeeper-docker/commit/5076660820c73f3b119cbdd1267c25a1e29cbbf4). Alternatively, providing an updated Dockerfile with FROM eclipse-temurin:11-jre-jammy should be enough to fix the build and let it rebuild for base image updates but not move to a new JRE or Ubuntu release.

31z4 commented 4 months ago

Thanks for reporting @yosifkit 👍

Alternatively, providing an updated Dockerfile with FROM eclipse-temurin:11-jre-jammy should be enough to fix the build and let it rebuild for base image updates but not move to a new JRE or Ubuntu release.

I'm gonna take this route as the safest (https://github.com/docker-library/official-images/pull/15544#discussion_r1361708245).