Sign inSign up

cheewai/geoserver

By cheewai

Updated over 7 years ago

Geoserver in Docker with Tomcat and Oracle JRE using Alpine base image

Image
0

307

cheewai/geoserver repository overview

Geoserver in Docker with Tomcat and Oracle JRE

Use this repo to build a small footprint docker image containing the following based on alpine linux:

  • Tomcat (versions tested compatible with Geoserver)
  • Oracle JDK 8
  • su-exec
  • dockerize

To enable strong cryptography in Oracle JRE, the image contains local_policy.jar and US_export_policy.jar extracted from http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip

The Dockerfile is adapted from the following primarily because Oracle JDK 7 is no longer available

su-exec has been included so that tomcat would run as non-root user for better security. The docker image uses /docker-entrypoint.sh to run tomcat as non-root user. The numeric UID of this user in the container defaults to 1000 but it may be overridden with the environment variable TOMCAT_UID.

dockerize may be used to wait for any dependent container (service) to be ready before starting Tomcat. To use it, define the environment variable DOCKERIZE_CMD with the full command, e.g. dockerize -wait=tcp://my_postgresql_host_ip:5432 -timeout=30m.

Even though GeoServer has only been officially tested with JRE7, it seems to work fine with JRE8.

Usage

Tomcat webapps directory in the container is /usr/tomcat/webapps/

Override any JRE JAVA default values using environment in docker-compose.yml file. GeoServer requires MINMEM greater or equal to 64 MB.

A complete sample docker-compose.yml may look like this:

geoserver:
  image: cheewai/tomcat
  environment:
    - TOMCAT_UID=1001
    - MAXMEM=2g
    - GEOSERVER_DATA_DIR=/var/geoserver
    - GEOSERVER_LOG_LOCATION=/logs/geoserver.log
  volumes:
    - ./gsdata:/var/geoserver
    - ./logs:/logs
  ports:
    - "8080:8080"

When Geoserver starts up, its CPU and RAM usage spikes. If you don't provide enough, it will take a long time to be ready, if at all.

Using docker-compose.yml version 3 for docker stack deploy:

    deploy:
      resources:
        limits:
          cpus: '4.0'
          memory: 3g

Using docker-compose.yml version 2.2 for docker-compose:

    cpus: 4
    mem_limit: 3g

CAVEAT

  • If you include community plugin geofence and leave it unconfigured, Geoserver will malfunction

Tag summary

Content type

Image

Digest

Size

347.7 MB

Last updated

over 7 years ago

docker pull cheewai/geoserver:tomcat-8.5