docker-py login doesn't save credentials to $HOME/.docker/config.json

Created on 10 May 2016  路  5Comments  路  Source: docker/docker-py

docker-py (1.8.0)
Python 2.7.6
Docker version 1.10.3, build 20f81dd

The docker login cli saves the creds to $HOME/.docker/config.json. This api call doesn't seem to do the same. Not that familiar with docker-py, does it save the creds in the object? How does it work exactly?

In the docker-py docs supposedly they are identical except for being non-interactive.

groudocumentation

Most helpful comment

why couldn't docker-py's login function simply have a persist parameter, which, on success, writes the authentication out to `$HOME/.docker/config.json? Seems simple enough.

All 5 comments

docker-py doesn't update the config,json file.

You're right to point that out - we should update the documentation to reflect that more accurately.

Hi @shin-,

Can you explain how login works? With respect to pulling/pushing after it's called. Does the client maintain some state and you have to reuse it?

Trying to use docker-compose via cli (since it's not yet in docker-py) after calling this and doesn't seem to authenticate when pulling.

The login token is kept in memory by the Client object, but it won't be available to the outside (including programs like docker-compose).

If you need to persist your credentials, you can either

  • Use the docker login command.
  • Write into the config.json file manually using python or some other script. docker-py, unfortunately, isn't designed for this task.

why couldn't docker-py's login function simply have a persist parameter, which, on success, writes the authentication out to `$HOME/.docker/config.json? Seems simple enough.

@shin- Is this still the case with docker-py?

I see a parameter on the login method for the docker config file, but when I pass the path it does not seem to write anything to the file.

Was this page helpful?
0 / 5 - 0 ratings