How to run MapTiler Server using Docker Compose
This article provides instructions on how to run MapTiler Server using Docker Compose.
Installation
To install MapTiler Server as a Docker image, run docker pull maptiler/server:latest
Prepare docker-compose
Let’s assume, we start blank on the computer in our path /Projects/server/
. The simple docker-compose.yml
with basic nginx configuration (nginx.conf
in the second below) are:
# ===============================
# docker-compose.yml
version: "3.5"
services:
server:
container_name: server
image: maptiler/server:latest
command: --adminPassword=${ADMIN_PASS:-"admin123"}
restart: "always"
volumes:
- ./data/:/data/
- ./log/server/:/data/logs/
environment:
MAPTILER_SERVER_LICENSE: ${MAPTILER_SERVER_LICENSE:-""}
nginx:
container_name: nginx
image: nginx:1.25-alpine
restart: "always"
depends_on:
- server
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/server.conf:ro
- ./log/nginx/:/var/log/nginx/
# ===============================
# nginx.conf
server {
listen 80;
server_name maps.company.com;
access_log /var/log/nginx/maptiler_server_access.log;
error_log /var/log/nginx/maptiler_server_error.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header Access-Control-Allow-Origin;
add_header 'Access-Control-Allow-Origin' 'maps.company.com';
proxy_pass http://server:3650;
proxy_read_timeout 90;
proxy_redirect http://server:3650 http://maps.company.com;
# client_max_body_size 20G;
# client_max_body_size 100M;
client_max_body_size 3G;
}
}
Now put your GeoPackage or MBTiles data into the folder data
(/Projects/server/data/
), update your server name (instead of maps.company.com
).
Start docker-compose
With prepared sample data, you can start docker in the background (as a daemon):
$ docker compose up -d
Now open your browser with the server name: maps.company.com
Configuration
There are some interesting options, you can update in the basic sample. For example, you can set your custom password to the Admin web interface or use your MapTiler License Server via environment variables.
# vi .env
ADMIN_PASS=mySecretAdminPASS
MAPTILER_SERVER_LICENSE=YOUR-SERVER-LICENSE-KEY
$ docker compose up -d
You can adjust nginx configuration, change the max uploaded size via client_max_body_size
, or increase the time for reading proxy_read_timeout
. If you want to enable loading tiles outside your website, remove the line add_header 'Access-Control-Allow-Origin' 'maps.company.com';
Useful links
Docker Desktop
MapTiler Server for Docker
MapTiler Engine for Docker