Skip to content

push fails when string includes a tag #282

@ghost

Description

I'm trying to push a tagged image to my private repository and I'm running into an error when the tag is part of the string passed to the repository argument.

if I were doing this in the command line I would run

docker push <PRIVATE_REGISTRY_HOST>:5000/hello_92e2b00:accepted

This works as I expect, but using the push method in python does not work as expected and I don't see any way to push any tag through the python client. I would expect the behavior to be similar to the pull method which has a tag optional argument, and parses the repository tag when passed in as part of the repository argument.

I see the following when trying to push with the library

>>> c = docker.Client(os.environ['DOCKER_HOST'])
>>> c.push("<PRIVATE_REGISTRY_HOST>:5000/hello_92e2b00:accepted")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/docker/client.py", line 674, in push
    or self._result(response)
  File "/usr/local/lib/python2.7/site-packages/docker/client.py", line 119, in _result
    self._raise_for_status(response)
  File "/usr/local/lib/python2.7/site-packages/docker/client.py", line 115, in _raise_for_status
    raise APIError(e, response, explanation=explanation)
docker.client.APIError: 500 Server Error: Internal Server Error ("Invalid repository name (hello_92e2b00:accepted), only [a-z0-9-_.] are allowed")

I'd be happy to take a crack at implementing the optional tag argument and handling a tag passed in the repository string if this is the intended behavior.

I hope I'm not missing something stupid. :)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions