aio-libs / aiodocker

Python Docker API client based on asyncio and aiohttp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing write access to registry does not throw exception

puinenveturi opened this issue · comments

Long story short

  • Expected behaviour: Missing write access to a registry should raise an exception
  • Actual behaviour: Missing write access does not raise any exception, so there is no way to catch and discover it, that the push did not take place

How to reproduce

  1. Try to push to a registry where the user exists but does not have write access to a given repository
  2. Notice that there is no exception thrown
        try:
            # user exists but does not have access right to the registy under "target_path"
            registry_auth = {
                "username": cfg["docker_registry"]["username"],
                "password": cfg["docker_registry"]["password"]
            }

            await docker.images.push(
                target_path,
                tag=target_tag,
                auth=registry_auth
            )

        # this except block is not activated
        except aiodocker.exceptions.DockerError as e:
            raise Exception("docker error", str(e))

        # the logs say success, but the push did not take place
        print(f"({str(processing_id)}) Pushing Docker image is completed")

Your environment

Docker: Docker repository hosted with Nexus 3 Repository Manager. The user I have connected to the Repository did not have write access rights to the Docker repository I wanted to push to.

Python: Official python docker image (3.7) with aiodocker "version": "==0.17.0"