From 66eaf6b1f15a7400ec00be40c0c1963951797983 Mon Sep 17 00:00:00 2001 From: John McGrath Date: Mon, 12 Aug 2024 09:21:44 -0500 Subject: [PATCH 1/5] fixed --- .github/workflows/docker-build-test-upload.yml | 4 ++-- Makefile | 2 +- images/docker-stacks-foundation/Dockerfile | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index c1fcae987a..7d9834f866 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -77,9 +77,9 @@ jobs: platform: ${{ inputs.platform }} variant: ${{ inputs.parent-variant }} - - name: Pull ubuntu:22.04 image 📥 + - name: Pull ubuntu:24.04 image 📥 if: inputs.parent-image == '' - run: docker pull ubuntu:22.04 + run: docker pull ubuntu:24.04 shell: bash - name: Build image 🛠 diff --git a/Makefile b/Makefile index 98fa4d6578..51ea5233d2 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ help: build/%: DOCKER_BUILD_ARGS?= -build/%: ROOT_CONTAINER?=ubuntu:22.04 +build/%: ROOT_CONTAINER?=ubuntu:24.04 build/%: ## build the latest image for a stack using the system's architecture docker build $(DOCKER_BUILD_ARGS) --rm --force-rm --tag "$(REGISTRY)/$(OWNER)/$(notdir $@):latest" "./images/$(notdir $@)" --build-arg REGISTRY="$(REGISTRY)" --build-arg OWNER="$(OWNER)" @echo -n "Built image size: " diff --git a/images/docker-stacks-foundation/Dockerfile b/images/docker-stacks-foundation/Dockerfile index 84d57235e9..92a5d285da 100644 --- a/images/docker-stacks-foundation/Dockerfile +++ b/images/docker-stacks-foundation/Dockerfile @@ -1,9 +1,9 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. -# Ubuntu 22.04 (jammy) -# https://hub.docker.com/_/ubuntu/tags?page=1&name=jammy -ARG ROOT_CONTAINER=ubuntu:22.04 +# Ubuntu 24.04 (noble) +# https://hub.docker.com/_/ubuntu/tags?page=1&name=noble +ARG ROOT_CONTAINER=ubuntu:24.04 FROM $ROOT_CONTAINER @@ -73,6 +73,8 @@ RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashr RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \ sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers && \ sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers && \ + # Delete existing user 'ubuntu' with UID=1000 + userdel -Rz ubuntu && \ useradd --no-log-init --create-home --shell /bin/bash --uid "${NB_UID}" --no-user-group "${NB_USER}" && \ mkdir -p "${CONDA_DIR}" && \ chown "${NB_USER}:${NB_GID}" "${CONDA_DIR}" && \ From 8df4e4e7f0f0a57046851164e0b9d904a22e9ad1 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 19 Aug 2024 12:58:56 +0100 Subject: [PATCH 2/5] Update .github/workflows/docker-build-test-upload.yml --- .github/workflows/docker-build-test-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 7d9834f866..a7bb1950b8 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -77,7 +77,7 @@ jobs: platform: ${{ inputs.platform }} variant: ${{ inputs.parent-variant }} - - name: Pull ubuntu:24.04 image 📥 + - name: Pull base ubuntu image 📥 if: inputs.parent-image == '' run: docker pull ubuntu:24.04 shell: bash From bf01844079021882ab9a8cb8fe85080a91b2b8eb Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 26 Aug 2024 12:42:58 +0100 Subject: [PATCH 3/5] Only remove user with uid 1000 if it exists --- images/docker-stacks-foundation/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/images/docker-stacks-foundation/Dockerfile b/images/docker-stacks-foundation/Dockerfile index 5a57730da9..fd75704168 100644 --- a/images/docker-stacks-foundation/Dockerfile +++ b/images/docker-stacks-foundation/Dockerfile @@ -68,13 +68,16 @@ RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashr # and docs: https://docs.conda.io/projects/conda/en/latest/dev-guide/deep-dives/activation.html echo 'eval "$(conda shell.bash hook)"' >> /etc/skel/.bashrc +# Delete existing user with UID=1000 if it exists +RUN if $(grep -q 1000 /etc/passwd); then \ + userdel --remove --selinux-user $(id -un 1000); \ + fi + # Create NB_USER with name jovyan user with UID=1000 and in the 'users' group # and make sure these dirs are writable by the `users` group. RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \ sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers && \ sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers && \ - # Delete existing user 'ubuntu' with UID=1000 - userdel -Rz ubuntu && \ useradd --no-log-init --create-home --shell /bin/bash --uid "${NB_UID}" --no-user-group "${NB_USER}" && \ mkdir -p "${CONDA_DIR}" && \ chown "${NB_USER}:${NB_GID}" "${CONDA_DIR}" && \ From 635ae9d1d92f3c15db936e2f2c870f5f34098e7b Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 26 Aug 2024 12:46:03 +0100 Subject: [PATCH 4/5] Update Dockerfile --- images/docker-stacks-foundation/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/docker-stacks-foundation/Dockerfile b/images/docker-stacks-foundation/Dockerfile index 54d6d9dd59..e8ea983274 100644 --- a/images/docker-stacks-foundation/Dockerfile +++ b/images/docker-stacks-foundation/Dockerfile @@ -69,8 +69,8 @@ RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashr echo 'eval "$(conda shell.bash hook)"' >> /etc/skel/.bashrc # Delete existing user with UID=1000 if it exists -RUN if $(grep -q 1000 /etc/passwd); then \ - userdel --remove --selinux-user $(id -un 1000); \ +RUN if $(grep -q "${NB_UID}" /etc/passwd); then \ + userdel --remove $(id -un "${NB_UID}"); \ fi # Create NB_USER with name jovyan user with UID=1000 and in the 'users' group From d054e54ba25d26f8f6aa3b89fd91a68f956bd74b Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 26 Aug 2024 13:17:21 +0100 Subject: [PATCH 5/5] Update Dockerfile --- images/docker-stacks-foundation/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/docker-stacks-foundation/Dockerfile b/images/docker-stacks-foundation/Dockerfile index e97ada6e5c..7ffaadb879 100644 --- a/images/docker-stacks-foundation/Dockerfile +++ b/images/docker-stacks-foundation/Dockerfile @@ -69,7 +69,8 @@ RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashr echo 'eval "$(conda shell.bash hook)"' >> /etc/skel/.bashrc # Delete existing user with UID="${NB_UID}" if it exists -RUN if $(grep -q "${NB_UID}" /etc/passwd); then \ +# hadolint ignore=SC2046 +RUN if grep -q "${NB_UID}" /etc/passwd; then \ userdel --remove $(id -un "${NB_UID}"); \ fi