qfieldcloud icon indicating copy to clipboard operation
qfieldcloud copied to clipboard

"pull access denied" error on self-hosted instance when trying to download project to QField

Open andreassteffens opened this issue 2 years ago • 2 comments
trafficstars

Hi,

i've set up my own QFiedCloud instance and also managed to upload a project from QGIS. Unfortunately, when trying to download the project to QField i'm getting an error. After logging in to the admin backend i see the following trace in the failed job's detailed description:

{ "error": "404 Client Error: Not Found (\"pull access denied for qfieldcloud-qgis, repository does not exist or may require 'docker login': denied: requested access to the resource is denied\")", "error_origin": "worker_wrapper", "error_stack": [ " File \"/usr/src/app/worker_wrapper/wrapper.py\", line 122, in run\n exit_code, output = self._run_docker(\n", " File \"/usr/src/app/worker_wrapper/wrapper.py\", line 256, in _run_docker\n container: Container = client.containers.run( # type:ignore\n", " File \"/usr/local/lib/python3.10/site-packages/docker/models/containers.py\", line 805, in run\n self.client.images.pull(image, platform=platform)\n", " File \"/usr/local/lib/python3.10/site-packages/docker/models/images.py\", line 444, in pull\n pull_log = self.client.api.pull(\n", " File \"/usr/local/lib/python3.10/site-packages/docker/api/image.py\", line 415, in pull\n self._raise_for_status(response)\n", " File \"/usr/local/lib/python3.10/site-packages/docker/api/client.py\", line 263, in _raise_for_status\n raise create_api_error_from_http_exception(e)\n", " File \"/usr/local/lib/python3.10/site-packages/docker/errors.py\", line 31, in create_api_error_from_http_exception\n raise cls(e, response=response, explanation=explanation)\n" ] }

Any pointer as to how the pblem can be solved would be greatly appreciated!

andreassteffens avatar May 31 '23 14:05 andreassteffens

I ran into the same issue, it looks like the worker_wrapper service is launching some jobs using a docker image whose name is in the QGIS_CONTAINER_NAME environment variable.

By default this variable is defined like this: QGIS_CONTAINER_NAME: ${COMPOSE_PROJECT_NAME}-qgis, so it will be qfieldcloud-qgis.

The issue is that no image with this name can be found:

  • the "official" image on dockerhub is called opengisch/qfieldcloud-qgis
  • the local image that is built from the docker-qgis is actually called qfieldcloud_qgis (the concatenation of the variable COMPOSE_PROJECT_NAME and the name of the service, with an underscore between)

A quick workaround could be to add image: qfieldcloud-qgis in the qgis service of the docker-compose file, so that the image the wrapper is looking for is present with the correct name.

  qgis:
    build:
      context: ./docker-qgis
      network: host
    image: qfieldcloud-qgis
    tty: true
    command: bash -c "echo QGIS built"
    logging: *default-logging

Or to change the value or the QGIS_CONTAINER_NAME environment variable and set it to ${COMPOSE_PROJECT_NAME}_qgis

gounux avatar Jun 21 '23 08:06 gounux

Hey @andreassteffens, thanks for reporting. What @gounux is proposing is actually a workaround that I also had to apply myself on one of my machines. Since (or around the time) docker-compose became docker compose, they changed the default container name separator from - to _. I didn't find a way that works for both worlds without changing QGIS_CONTAINER_NAME.

suricactus avatar Jun 22 '23 16:06 suricactus