Apache Solr open-source search software
SOLR-17353 Remove gosu binary from the Docker image (#4285)
Jan Høydahla1df8522723b
diff --git a/changelog/unreleased/SOLR-17353-remove-gosu-from-docker.yml b/changelog/unreleased/SOLR-17353-remove-gosu-from-docker.ymlnew file mode 100644index 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-17353diff --git a/solr/docker/templates/Dockerfile.body.template b/solr/docker/templates/Dockerfile.body.templateindex 57c5793a7c3..f10eb027bc6 100644--- a/solr/docker/templates/Dockerfile.body.template+++ b/solr/docker/templates/Dockerfile.body.template@@ -69,7 +69,7 @@ RUN set -ex; \RUN set -ex; \apt-get update; \- apt-get -y --no-install-recommends install curl acl lsof procps wget netcat-openbsd gosu tini jattach; \+ apt-get -y --no-install-recommends install curl acl lsof procps wget netcat-openbsd tini jattach; \rm -rf /var/lib/apt/lists/*;VOLUME /var/solrdiff --git a/solr/docker/tests/cases/gosu/test.sh b/solr/docker/tests/cases/gosu/test.shdeleted file mode 100755index 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-10.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adocindex 64cd50064ec..3a250b69060 100644--- a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc+++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc@@ -331,3 +331,7 @@ Older segments will continue to be readable.WARNING: After upgrading to Solr 10.1, downgrading to an earlier Solr 10.0.x version may fail because the older version does not include the `Lucene104` codec needed to read the newly written segments.If you require the ability to roll back, back up your indexes before upgrading.++=== 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`.