docker-geoserver

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.

Versions

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}"

Features

Trusted builds

Active versions with automated builds available on docker registry:

Other experimental (not automated build):

Running

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

Using docker-compose:

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

Customize JAVA_OPTS

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

Configure your own extensions

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 the WEB-INF/lib directory of the GeoServer installation. Make sure to include only .jar files from trusted extensions to avoid security risks.

Configure path

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.

Logs

See the tomcat logs while running:

docker logs -f MyGeoServerInstance