docker-py
docker-py copied to clipboard
Api documentation error
hello:
When I create a container with the document, it always prompts me that the api attribute does not exist:
https://docker-py.readthedocs.io/en/stable/api.html
After testing, I found that the api document is wrong, not client.api.create_container, it should be client.create_container.
That sounds like you are using Docker SDK for Python version < 2.0.0 (you can get that with pip install docker-py
instead of pip install docker
). That was last released in November 2016. Please make sure you use a newer version of Docker SDK for Python (pip install docker
).
Also note that if you installed both docker-py
and docker
, both will be broken. You first need to uninstall both (!) before re-installing one of them (please use docker
and not docker-py
).
I believe this is actually an issue with the following lines: client = docker.APIclient container_id=client.api.create_container
I think you're essentially doing api.api and that's why it says APIClient object has no attribute api.
I would remove one of the api attributes from either. I think it's generally easier to do it from the first as it would give you more flexibility when using client in the future