Getting the image
There are various ways to get the image onto your system:
- Pulling from Dockerhub
- Local build using docker-compose
Pulling from Dockerhub
The preferred way (but using most bandwidth for the initial image) is to get our docker trusted build like this:
VERSION=2.22.0
docker pull kartoza/geoserver:$VERSION
Building the image
Local build using repository checkout
To build yourself with a local checkout using the docker-compose.build.yaml:
- Clone the GitHub repository:
git clone https://github.com/kartoza/docker-geoserver
- Edit the .env to change the build arguments:
IMAGE_VERSION=[dockerhub tomcat](https://hub.docker.com/_/tomcat/)
JAVA_HOME= java home path corresponding to the tomcat version
WAR_URL= Default URL to fetch GeoServer war or zip file
STABLE_PLUGIN_URL= URL to fetch GeoServer plugins
DOWNLOAD_ALL_STABLE_EXTENSIONS= Specifies whether to download all stable plugins or a single one
DOWNLOAD_ALL_COMMUNITY_EXTENSIONS=Specifies whether to download all community plugins or a single one
GEOSERVER_UID=Specifies the uid to use for the user used to run GeoServer in the container
GEOSERVER_GID=Specifies the gid to use for the group used to run GeoServer in the container
- Build the container and spin up the services
cd docker-geoserver
docker-compose -f docker-compose-build.yml up -d --build
Building with a specific version of Tomcat
To build using a specific tagged release for tomcat image set the
IMAGE_VERSION
build-arg to 8-jre8
: See the dockerhub tomcat
to choose which tag you need to build against.
ie VERSION=2.22.0
docker build --build-arg IMAGE_VERSION=8-jre8 --build-arg GS_VERSION=2.22.0 -t kartoza/geoserver:${VERSION} .
For some recent builds it is necessary to set the JAVA_PATH as well (e.g. Apache Tomcat/9.0.36)
docker build --build-arg IMAGE_VERSION=9-jdk11-openjdk-slim --build-arg JAVA_HOME=/usr/local/openjdk-11/bin/java --build-arg GS_VERSION=2.22.0 -t kartoza/geoserver:2.22.0 .
Note: Please check the GeoServer documentation to see which tomcat versions are supported.
Building on Windows
These instructions detail the recommended process for reliably building this on Windows.
Prerequisites - You will need to have this software preinstalled on the system being used to build the Geoserver image:
Add the conda-forge channel to your conda installation:
conda config --add channels conda-forge
Now create a new conda environment with GDAL, installed from conda. Ensure that this environment is active when running the docker build, e.g.
conda create -n geoserver-build -c conda-forge python gdal
conda activate geoserver-build
Modify the .env
with the appropriate environment variables. It is recommended that shortpaths (without whitespace)
are used with forward slashes to prevent errors. You can get the current java command short path with powershell:
(New-Object -ComObject Scripting.FileSystemObject).GetFile((get-command java).Source).ShortPath
Running the above command should yield a path similar to C:/PROGRA~1/Java/JDK-15~1.2/bin/java.exe
, which can be
assigned to JAVA_HOME
in the environment confoguration file.
Then run the docker build commands. If you encounter issues, you may want to ensure that you try to build the image without the cache and then run docker up separately:
docker-compose -f docker-compose-build.yml build --force-rm --no-cache
docker-compose -f docker-compose-build.yml up -d