Page MenuHomePhabricator

docker-pkg error messages are confusing
Open, Needs TriagePublic

Description

While working on ceph images, I had a version in changelog that docker-pkg was unhappy with (18.2.2~wmf1, which is a legit Debian version, but docker-pkg doesn't like).

The error output (see typescript below) is pretty unclear - the naïve user (i.e. me!) will spend quite a lot of time confused by the localhost URLs and might miss the invalid reference format note that means "your package version is duff".

== Step 0: scanning /home/matthew/operations/docker-images/production-images/images/ ==
Traceback (most recent call last):
  File "/home/matthew/.local/lib/python3.9/site-packages/docker-5.0.3-py3.9.egg/docker/api/client.py", line 268, in _raise_for_status
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.41/images/docker-registry.wikimedia.org/ceph:18.2.2~wmf1/json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/builder.py", line 286, in _process_dockerfile_template
    return ImageFSM(root, self.client, self.config, self.nocache, self.pull)
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/builder.py", line 64, in __init__
    elif self.image.exists():
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/image.py", line 71, in exists
    return self.driver.exists()
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/drivers.py", line 178, in exists
    self.client.images.get(self.label.image())
  File "/home/matthew/.local/lib/python3.9/site-packages/docker-5.0.3-py3.9.egg/docker/models/images.py", line 314, in get
    return self.prepare_model(self.client.api.inspect_image(name))
  File "/home/matthew/.local/lib/python3.9/site-packages/docker-5.0.3-py3.9.egg/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/home/matthew/.local/lib/python3.9/site-packages/docker-5.0.3-py3.9.egg/docker/api/image.py", line 251, in inspect_image
    return self._result(
  File "/home/matthew/.local/lib/python3.9/site-packages/docker-5.0.3-py3.9.egg/docker/api/client.py", line 274, in _result
    self._raise_for_status(response)
  File "/home/matthew/.local/lib/python3.9/site-packages/docker-5.0.3-py3.9.egg/docker/api/client.py", line 270, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/home/matthew/.local/lib/python3.9/site-packages/docker-5.0.3-py3.9.egg/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.41/images/docker-registry.wikimedia.org/ceph:18.2.2~wmf1/json: Bad Request ("no such image: docker-registry.wikimedia.org/ceph:18.2.2~wmf1: invalid reference format")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/matthew/.local/bin/docker-pkg", line 33, in <module>
    sys.exit(load_entry_point('docker-pkg==4.0.0', 'console_scripts', 'docker-pkg')())
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/cli.py", line 197, in main
    build(application, log_to_stdout)
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/cli.py", line 208, in build
    application.scan(max_workers=application.config["scan_workers"])
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/builder.py", line 279, in scan
    for img in imgs:
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 600, in result_iterator
    yield fs.pop().result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 433, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/matthew/.local/lib/python3.9/site-packages/docker_pkg-4.0.0-py3.9.egg/docker_pkg/builder.py", line 289, in _process_dockerfile_template
    raise RuntimeError(
RuntimeError: The image in /home/matthew/operations/docker-images/production-images/images/ceph could not be loaded, check the logs for details

Event Timeline

(if you try and build any other image, you still get the same error, which led me to assume my docker-pkg setup was faulty somehow - again, in hindsight, the error message does say it's unhappy with the ceph image, but the naïve user will observe the same bad request for localhost/v1.41/images/docker-registry.wikimedia.org/ and get led down the garden path.)