From a208d62bd772e7dbdf2983634b16c5f47bead06a Mon Sep 17 00:00:00 2001 From: Emilio Lahr-Vivaz Date: Fri, 26 Apr 2024 09:43:24 -0400 Subject: [PATCH] Docker run script updates for rootless docker --- build/run-geoserver.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/run-geoserver.sh b/build/run-geoserver.sh index 814eb68..ce0c8d4 100755 --- a/build/run-geoserver.sh +++ b/build/run-geoserver.sh @@ -191,9 +191,18 @@ entrypoint="$entrypoint && echo 'tomcat.util.scan.StandardJarScanFilter.jarsToSk # the default container entrypoint is 'catalina.sh run' entrypoint="$entrypoint && exec catalina.sh run" +if ! docker network ls | grep -q geomesa; then + echo "Creating docker network" + docker network create geomesa +fi + echo "Starting geoserver" # add-opens required by arrow for jdk 11+ +# use ! to prevent exit on error as we want to always run the permissions cleanup step +# shellcheck disable=SC2251 ! docker run --rm \ + --name geoserver \ + --network geomesa \ -p 8080:8080 -p 5005:5005 \ -v "$gs_war:/usr/local/tomcat/webapps/geoserver" \ -v "$data_dir:/tmp/data" \ @@ -202,7 +211,7 @@ echo "Starting geoserver" "$image" \ -c "$entrypoint" -if [[ -z "$(docker info -f "{{println .SecurityOptions}}" | grep rootless)" ]]; then +if ! docker info -f "{{println .SecurityOptions}}" | grep -q rootless; then # reset permissions on the datadir so that it doesn"t end up owned by tomcat docker run --rm \ -v "$data_dir:/tmp/data" \