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.
2 Answers 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.
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
-
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, FerFer– Fer2022年09月10日 23:56:57 +00:00Commented Sep 10, 2022 at 23:56
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 theMAP=/etc/qgisserver/myproject_2.qgs
. I didn't try, just reading the documentation on hub.docker.com/r/camptocamp/qgis-server Do not useQGIS_PROJECT_FILE
variable.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.MAP=
? Just in case. I got this issue last week: github.com/qgis/QGIS/issues/32354 which has been fixed.