This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 7d7c64d7506 SOLR-17353 Remove gosu binary from the Docker image 
(#4285) (branch_9x) (#4287)
7d7c64d7506 is described below

commit 7d7c64d7506eaca8abe12a2cc8ffc344709a2a57
Author: Jan Høydahl <[email protected]>
AuthorDate: Thu Apr 16 22:58:39 2026 +0200

    SOLR-17353 Remove gosu binary from the Docker image (#4285) (branch_9x) 
(#4287)
---
 .../SOLR-17353-remove-gosu-from-docker.yml         |  8 +++
 solr/docker/templates/Dockerfile.body.template     |  2 +-
 solr/docker/tests/cases/gosu/test.sh               | 81 ----------------------
 .../pages/major-changes-in-solr-9.adoc             |  4 ++
 4 files changed, 13 insertions(+), 82 deletions(-)

diff --git a/changelog/unreleased/SOLR-17353-remove-gosu-from-docker.yml 
b/changelog/unreleased/SOLR-17353-remove-gosu-from-docker.yml
new file mode 100644
index 00000000000..cad475b362c
--- /dev/null
+++ b/changelog/unreleased/SOLR-17353-remove-gosu-from-docker.yml
@@ -0,0 +1,8 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Remove gosu from the Docker image. The Solr Docker image no longer 
installs the gosu binary.
+type: removed
+authors:
+  - name: Jan Høydahl
+links:
+- name: SOLR-17353
+  url: https://issues.apache.org/jira/browse/SOLR-17353
diff --git a/solr/docker/templates/Dockerfile.body.template 
b/solr/docker/templates/Dockerfile.body.template
index 777d051ca19..0d08e2c9f2f 100644
--- a/solr/docker/templates/Dockerfile.body.template
+++ b/solr/docker/templates/Dockerfile.body.template
@@ -71,7 +71,7 @@ RUN set -ex; \
 
 RUN set -ex; \
     apt-get update; \
-    apt-get -y --no-install-recommends install acl lsof procps wget netcat 
gosu tini jattach; \
+    apt-get -y --no-install-recommends install acl lsof procps wget netcat 
tini jattach; \
     rm -rf /var/lib/apt/lists/*;
 
 VOLUME /var/solr
diff --git a/solr/docker/tests/cases/gosu/test.sh 
b/solr/docker/tests/cases/gosu/test.sh
deleted file mode 100755
index e7d0e85d57f..00000000000
--- a/solr/docker/tests/cases/gosu/test.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# A simple test of gosu. We create a myvarsolr, and chown it
-
-if [[ "$OSTYPE" == "darwin"* ]]; then
-  # TODO: Fix this test on Mac
-  echo "WARNING: Ignoring test 'gosu' on macOS"
-  exit 0
-fi
-
-set -euo pipefail
-
-TEST_DIR="${TEST_DIR:-$(dirname -- "${BASH_SOURCE[0]}")}"
-source "${TEST_DIR}/../../shared.sh"
-
-myvarsolr="${BUILD_DIR}/myvarsolr-${container_name}"
-prepare_dir_to_mount 8983 "$myvarsolr"
-
-echo "Running $container_name"
-docker run --user 0:0 --name "$container_name" -d -e VERBOSE=yes \
-  -v "$myvarsolr:/var/solr" "$tag" \
-  bash -c "chown -R solr:solr /var/solr; touch /var/solr/root_was_here; exec 
gosu solr:solr solr-precreate gettingstarted"
-
-wait_for_container_and_solr "$container_name"
-
-echo "Loading data"
-docker exec --user=solr "$container_name" bin/solr post -c gettingstarted 
example/exampledocs/manufacturers.xml
-sleep 1
-echo "Checking data"
-data=$(docker exec --user=solr "$container_name" wget -q -O - 
'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')
-if ! grep -E -q 'One Dell Way Round Rock, Texas 78682' <<<"$data"; then
-  echo "Test $TEST_NAME $tag failed; data did not load"
-  exit 1
-fi
-
-# check test file was created by root
-data=$(docker exec --user=root "$container_name" stat -c %U 
/var/solr/root_was_here )
-if [[ "$data" == *'No such file or directory' ]]; then
-  echo "Missing /var/solr/root_was_here"
-  exit 1
-fi
-if [[ "$data" != root ]]; then
-  echo "/var/solr/root_was_here is owned by $data"
-  exit 1
-fi
-
-# check core is created by solr
-data=$(docker exec --user=root "$container_name" stat -c %U 
/var/solr/data/gettingstarted/core.properties )
-if [[ "$data" == *'No such file or directory' ]]; then
-  echo "Missing /var/solr/data/gettingstarted/core.properties"
-  exit 1
-fi
-if [[ "$data" != solr ]]; then
-  echo "/var/solr/data/gettingstarted/core.properties is owned by $data"
-  exit 1
-fi
-
-container_cleanup "$container_name"
-
-# chown it back
-docker run --rm --user 0:0 -e VERBOSE=yes \
-  -v "$myvarsolr:/myvarsolr" "$tag" \
-  bash -c "chown -R $(id -u):$(id -g) /myvarsolr; ls -ld /myvarsolr"
-
-rm -fr "$myvarsolr"
-
-echo "Test $TEST_NAME $tag succeeded"
diff --git 
a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-9.adoc 
b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-9.adoc
index 7db51f45c24..c9d32d36194 100644
--- 
a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-9.adoc
+++ 
b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-9.adoc
@@ -77,6 +77,10 @@ Due to changes in Lucene 9, that isn't possible any more.
 
 == Solr 9.11
 
+=== Docker
+
+The `gosu` binary is no longer installed in the Solr Docker image. See 
https://github.com/tianon/gosu[gosu github page] for alternatives, such as 
`runuser`, `setpriv` or `chroot`.
+
 === Removing 'local' Tika
 
 The project normally doesn't remove functionality in a minor release, but we 
made an exception to avoid shipping Tika 1.x with known vulnerabilities.

Reply via email to