Docker-py: Support for Docker Compose API

Created on 29 Mar 2021  路  5Comments  路  Source: docker/docker-py

Does the current Python SDK have support for Docker Compose CLI?

Most helpful comment

Hello @haohanyang !

As @feliperuhland said, docker-compose depends on docker-py as a library.
And note that docker-compose is a final product, thus it does not have any kind of API to be used as code dependency on any means. Given that, the use docker-compose as a library is on your own responsibility.

All 5 comments

Hi @haohanyang

In fact, it's the opposite; docker-compose uses docker-py to access the docker engine.

You can use Docker Compose itself for that:

pip install docker-compose

Have a nice day :)

Thanks.
I want to setup a backend(flask) and do something like docker-compose -p myProject scale worker=5 via an API gateway(likeHTTP /rpc/scale?worker=5). How can I possibly do it?

Hi @haohanyang

Definitely, you will need docker-compose for that.

You can start here; that is the CLI main function.

Have a nice day :)

@ulyssessouza we can close this issue.

@haohanyang, if you have more questions, feel free to open a new issue.

Hello @haohanyang !

As @feliperuhland said, docker-compose depends on docker-py as a library.
And note that docker-compose is a final product, thus it does not have any kind of API to be used as code dependency on any means. Given that, the use docker-compose as a library is on your own responsibility.

Was this page helpful?
0 / 5 - 0 ratings