[GIS] QGIS Server – Docker – Multiple Projects

dockerqgis-server

I am currently trying to improve my companies server architecture with the help of Docker. I have successfully managed to run a docker container of this image: https://hub.docker.com/r/camptocamp/qgis-server. However the container only allows to serve one project by default.

Does anybody know how to serve multliple projects with a qgis server docker container?

I have tried to run a docker container of this image: https://github.com/kartoza/docker-qgis-server. However it didn't work. I guess the best approach is probably to change some configuration files in the docker container of the first mentioned container but I have no idea which files.

Best Answer

I found now a working solution for my problem. However to be honest I am not really convinced of this solution (but it is working). Currently I have used QGIS Server 2.18 but I think it should work similar with a QGIS 3 Version. My steps:

  • git clone https://github.com/kartoza/docker-qgis-server
  • create a folder with name "project" in the 2.18 directory but it is important to NOT include a "project.qgs" file. Copy all project files to that directory
  • In the Dockerfile in the 2.18 directory add a line: COPY project /project/ and delete the line: ENV QGIS_PROJECT_FILE /project/project.qgs
  • In the file \2.18\runtime\etc\apache2\conf-available\qgis.conf delete line 5 ( PassEnv QGIS_PROJECT_FILE)
  • Finally build and run the docker container as explained in the git repository

Furthermore it is important to mention that I was not able to get this working on a windows host machine. One reason therefore is explained here: https://blogs.msdn.microsoft.com/stevelasker/2016/09/22/running-scripts-in-a-docker-container-from-windows-cr-or-crlf/. But even after I applied the hints in the block post, I was not able to run it on Windows (no idea why). So I did this on a linux machine.