Skip to main content

Running QGIS in Docker

On Windows 10

First you need to install a X server, XMingin our case (download from sourceforge.net.

Create a docker-compose.yml file:

db:
image: kartoza/postgis:latest
environment:
- USERNAME=docker
- PASS=docker

qgisdesktop:
image: kartoza/qgis-desktop:latest
hostname: qgis-server
volumes:
# Wherever you want to mount your data from
# TODO
# Unix socket for X11
- C:\Users\bertrand.thomas\.X11-unix:/tmp/.X11-unix
links:
- db:db
environment:
- DISPLAY=192.168.1.48:0
command: qgis

Edit C:\Program Files (x86)\Xming\X0.hosts to add the IP address (192.168.1.48)

Execute from the command line (in the directory where the docker-compose file has been created):

docker-compose up

From QGIS you can add PostgreSQL DB access, you'll need to get the DB IP address

docker inspect kartoza_db_1

It works!

References:

TODO:

  • Update docker compose file to
    • Fix QGIS version 2.18.17
    • Fix PostgreSQL version 9.6.7
    • Install Python (2.7)
    • Fix file errors in the console (missing mapping)