camptocamp / docker-mapserver

https://hub.docker.com/r/camptocamp/mapserver/
BSD 2-Clause "Simplified" License
42 stars 29 forks source link

Docker image for MapServer

The main Mapfile should be in /etc/mapserver/.

You can use the image as is and mount a volume in /etc/mapserver/ to customize it.

Only tags for minor releases exist, not tag for bug fixes.

If the container is run as root, apache listens on port 80. If it is run as another user, it listens on port 8080.

Tunings

You can use the following environment variables (when starting the container) to tune it:

Running multiple Mapfiles

This section is for if you would like to use more than one Mapfile, or use a Mapfile that isn't /etc/mapserver/mapserver.map.

In this example we have two Mapfiles we want to use that both reference data in different directories. My Mapfiles are wms.map and wfs.map and are located in /mapfiles/ on the host, and the data for these Mapfiles is located in the host in the directory /mapdata/wms and /mapdata/wfs.

docker run -d \
  --restart=unless-stopped \
  --volume=/mapfiles/wms.map/:/etc/mapserver/wms.map:ro \
  --volume=/mapfiles/wfs.map/:/etc/mapserver/wfs.map:ro \
  --volume=/mapdata/wms/:/mapdata/wms/:ro \
  --volume=/mapdata/wfs/:/mapdata/wfs/:ro \
  camptocamp/mapserver

For accessing maps for the WFS service add map=/etc/mapserver/wfs.map to your query string. Here is the URL for a GetCapabilities request:

http://your.mapserver.host/?map=/etc/mapserver/wfs.map&service=WFS&request=GetCapabilities

Similarly, for accessing maps for the WMS service add map=/etc/mapserver/wms.map to your query string.

OGC API

This image can be used to serve OGC API Features and OGC API Tiles.

Some details about the configuration.

You should define the OGCAPI_HTML_TEMPLATE_DIRECTORY generally to /usr/local/share/mapserver/ogcapi/templates/html-bootstrap4/.

If you want to serve MapServer on a subpath, you can use the MAPSERVER_BASE_PATH with the subpath.

If you want to serve multiple MapFiles you should have a Config file with the MAPS directive.

In the Mapfile metadata you should have the following metadata (MAP.WEB.METADATA):

The landing page is served by on http://<host>:<port>/<base_path>/<map_name>/ogcapi.

Changelog

8.0

Contributing

Install the pre-commit hooks:

pip install pre-commit
pre-commit install --allow-missing-config