Create geoserver from docker
Create geoserver from docker

Guide: Deploying GeoServer with Docker

Using Docker to run GeoServer is the most efficient way to handle geospatial data without worrying about Java dependencies or environment conflicts.

1. Prerequisites

Ensure you have Docker and Docker Compose installed on your system. Since GeoServer is resource-intensive for large datasets, ensure your Docker engine has at least 2GB of RAM allocated.

2. Pull the GeoServer Image

There are several community-maintained images. The most popular is from kartoza. Pull the latest stable version:

Bash

docker pull kartoza/geoserver

3. Basic Deployment (Docker Run)

To get up and running instantly with default settings, use this command:

Bash

docker run -d -p 8080:8080 --name geoserver kartoza/geoserver
  • -d: Runs the container in the background (detached).
  • -p 8080:8080: Maps your local port 8080 to the container's port.

4. Advanced Setup (Docker Compose)

For production or persistent data, use a docker-compose.yml file to mount volumes for your data directory:

YAML

services:
  geoserver:
    image: kartoza/geoserver
    ports:
      - "8080:8080"
    volumes:
      - ./geoserver_data:/opt/geoserver/data_dir
    environment:
      - USER_NAME=admin
      - USER_PASSWORD=geoserver

Run it with: docker-compose up -d.

5. Access the Web Interface

Once the container is healthy, open your browser and navigate to: http://localhost:8080/geoserver

Default Credentials:

  • Username: admin
  • Password: geoserver

6. Connect Your Data

Inside the dashboard, you can now create Workspaces, add Stores (Shapefiles, PostGIS, GeoTIFF), and publish Layers to be served via WMS, WFS, or WCS.