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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Oct 30, 2019 at 17:04
4
  • 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. Commented Oct 31, 2019 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. Commented Oct 31, 2019 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. Commented Oct 31, 2019 at 16:55
  • Is the same :-( Commented Oct 31, 2019 at 17:02

2 Answers 2

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.

answered Nov 1, 2019 at 16:13
0

Late to the party, but I've solved it with this container: https://hub.docker.com/r/openquake/qgis-server.

You just put your QGIS project files into separate directories, mount the directory containing your projects as a volume in the container, and follow a basic convention to get WMS/WFS for your projects.

Project directory structure:

data 
 |
 |-- foo
 |-- foo.qgs
 |-- bar
 |-- bar.qgs

Endpoints examples:

  • http://localhost:8080/ogc/foo?SERVICE=WMS&REQUEST=GetCapabilities
  • http://localhost:8080/ogc/bar?SERVICE=WFS&REQUEST=GetCapabilities
answered Jun 18, 2021 at 8:55
1
  • I cannot install the container. I have good skills on desktop GIS, but not servers. I am starting running Docker containers and Portainer stacks, but have still low skills. Could you please, write a step-by-step guide on installing a Docker Qgis Server on a Synology NAS? Any help would be really appreciated though. I am planing on running a small service for my caving group to serve Cave locations in my area. I use reverse proxy for https connections. Kind regards, Fer Commented Sep 10, 2022 at 23:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.