2

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.

  • Can you explain why you can't add many project in the iimage you are already using? If you use the command line provided docker run -d -p 8380:80 --volume=$PWD/etc/qgisserver:/etc/qgisserver camptocamp/qgis-server, you can put as many as you want QGIS project in the current repository and call them with the MAP=/etc/qgisserver/myproject_2.qgs. I didn't try, just reading the documentation on hub.docker.com/r/camptocamp/qgis-server Do not use QGIS_PROJECT_FILE variable. – etrimaille Oct 31 '19 at 13:14
  • Yes, this sounds logical. For some reasons however it always shows me the default project - no matter what I request with the MAP parameter e.g. if I open: http://localhost:8380/?SERVICE=WMS&REQUEST=GetCapabilities in the Browser it is shown the capabilities of the project.qgs file which is as expected in this case. If i open however: http://localhost:8380/?SERVICE=WMS&REQUEST=GetCapabilities&Map=/etc/qgisserver/project2.qgs it is also shown the capabillities of the project.qgs file which is not as expected. This is true if the file exist and also if the file doesn't exist. – Jonathan Oct 31 '19 at 16:53
  • Can you try with MAP= ? Just in case. I got this issue last week: github.com/qgis/QGIS/issues/32354 which has been fixed. – etrimaille Oct 31 '19 at 16:55
  • Is the same :-( – Jonathan Oct 31 '19 at 17:02
2

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.