Dockerized GeoServer with extensions: Charts, Control Flow, CSS, MongoDB, Monitor, Query Layer, Vector Tiles, Authkey, GWC-S3, JDBC-Metrics, JDBCConfig, JDBCStore, Importer and Importer BDB.
The biggest change is the use of GeoServer 2.15.2, and the JAVA_OPTS.
heitorcarneiro/geoserver:2.15.2.2-java11-hotspot
# Tomcat environment
ENV GEOSERVER_OPTS "-server -Djava.awt.headless=true \
-Xms128M -Xmx756M \
-XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseParallelGC \
-XX:PerfDataSamplingInterval=500 -XX:NewRatio=2 \
-XX:-UseContainerSupport -XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=70 \
-Dorg.geotools.referencing.forceXY=true -Dfile.encoding=UTF8 -Duser.timezone=GMT -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=true \
-DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}"
heitorcarneiro/geoserver:2.15.2.2-java11-hotspot-readonly
# Tomcat environment
ENV GEOSERVER_OPTS "-server -Djava.awt.headless=true \
-Xms128M -Xmx756M -DGEOSERVER_CONSOLE_DISABLED=true \
-XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseParallelGC \
-XX:PerfDataSamplingInterval=500 -XX:NewRatio=2 \
-XX:-UseContainerSupport -XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=70 \
-Dorg.geotools.referencing.forceXY=true -Dfile.encoding=UTF8 -Duser.timezone=GMT -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=true \
-DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}"
heitorcarneiro/geoserver:2.15.2.2-java11-hotspot-master
# Tomcat environment
ENV GEOSERVER_OPTS "-server -Djava.awt.headless=true \
-Xms768M -Xmx2048M \
-XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseParallelGC \
-XX:PerfDataSamplingInterval=500 -XX:NewRatio=2 \
-XX:-UseContainerSupport -XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=70 \
-Dorg.geotools.referencing.forceXY=true -Dfile.encoding=UTF8 -Duser.timezone=GMT -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=true \
-DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}"
heitorcarneiro/geoserver:2.15.2.2-java11-hotspot-slave
# Tomcat environment
ENV GEOSERVER_OPTS "-server -Djava.awt.headless=true \
-Xms2G -Xmx3G -DGEOSERVER_CONSOLE_DISABLED=true \
-XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseParallelGC \
-XX:PerfDataSamplingInterval=500 -XX:NewRatio=2 \
-XX:-UseContainerSupport -XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=70 \
-Dorg.geotools.referencing.forceXY=true -Dfile.encoding=UTF8 -Duser.timezone=GMT -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=true \
-DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}"
- Built on top of Docker's official tomcat image.
- Taken care of JVM Options, to avoid PermGen space issues &c.
- Separate GEOSERVER_DATA_DIR location (on /var/local/geoserver).
- CORS ready.
- Automatic installation of Native JAI and Image IO for better performance.
- Configurable extensions.
- Automatic installation of Microsoft Core Fonts for better labelling compatibility.
- AWS configuration files and scripts in order to deploy easily using Elastic Beanstalk. See github repo.
- Extension Authkey installed by default.
- Extension Control Flow installed by default.
- Extension Monitor installed by default.
Active versions with automated builds available on docker registry:
Other experimental (not automated build):
-
oracle
. Uses wnameless/oracle-xe-11g, needs ojdbc7.jar and setting up a database. See the run commands. -
h2-vector
. Plays nice with hguerra/h2:geodb, and includes sample scripts for docker-compose and systemd.
Get the image:
docker pull heitorcarneiro/geoserver
Run as a service, exposing port 8080 and using a hosted GEOSERVER_DATA_DIR:
docker run -d -p 8080:8080 -v /path/to/local/data_dir:/var/local/geoserver --name=MyGeoServerInstance heitorcarneiro/geoserver
version: "3"
services:
db:
image: mdillon/postgis:11
restart: always
environment:
- POSTGRES_USER=geoserver
- POSTGRES_PASSWORD=geoserver
ports:
- "5432:5432"
volumes:
- "$PWD/postgres-data:/var/lib/postgresql/data"
- "$PWD/postgres-backup:/var/lib/postgresql/backup"
geoserver:
image: heitorcarneiro/geoserver:2.15.2.2-java11-hotspot
restart: always
environment:
- CATALINA_OPTS="-Djava.awt.headless=true -server -Xms512M -Xmx512M -DGEOSERVER_DATA_DIR=/var/local/geoserver"
ports:
- "8080:8080"
volumes:
- "$PWD/geoserver-data:/var/local/geoserver"
- "$PWD/geoservermaster-logs:/usr/local/tomcat/logs"
links:
- "db:postgis"
depends_on:
- "db"
mkdir postgres-data && mkdir postgres-backup && mkdir geoserver-data && mkdir geoservermaster-logs
docker-compose up
docker run --name "geoserver" --link "mydb:postgis" --network proxy -p "8080:8080" -v "$PWD/geoserver-data:/var/local/geoserver" -e CATALINA_OPTS="-Djava.awt.headless=true -server -Xms512M -Xmx512M -DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}" -d geoserver:2.15.2-java11-hotspot
To add extensions to your GeoServer installation, provide a directory with the unzipped extensions separated by directories (one directory per extension):
docker run -d -p 8080:8080 -v /path/to/local/exts_dir:/var/local/geoserver-exts/ --name=MyGeoServerInstance heitorcarneiro/geoserver
You can use the build_exts_dir.sh
script together with a extensions configuration file to create your own extensions directory easily.
Warning: The
.jar
files contained in the extensions directory will be copied to theWEB-INF/lib
directory of the GeoServer installation. Make sure to include only.jar
files from trusted extensions to avoid security risks.
It is also possible to configure the context path by providing a Catalina configuration directory:
docker run -d -p 8080:8080 -v /path/to/local/data_dir:/var/local/geoserver -v /path/to/local/conf_dir:/usr/local/tomcat/conf/Catalina/localhost --name=MyGeoServerInstance heitorcarneiro/geoserver
See some examples.
See the tomcat logs while running:
docker logs -f MyGeoServerInstance