Reputation: 1015
I created a fairly amount of docker-compose scripts which spawn up several services. I now want to control docker-compose in the JVM. Basically, I want to be able to execute up
and down
, ideally with -p <project name>
parameter, so I can spawn multiple instances at the same time.
Is this possible in Java?
Upvotes: 8
Views: 7129
Reputation: 74720
Docker Compose is a python utility that talks directly to the same Docker API as the all the other Docker clients. There's nothing fundamentally different about the commands it sends, but it does manage a lot of Docker container life cycle for you inside it's code.
Compose is based on the docker
python module which is just another python Docker API client.
It would probably take a lot to reimplement the same in Java, here is the up
method. Maybe try pulling that in with Jython if you really need to do it from the JVM or stick with executing the docker-compose
commands from Java.
Upvotes: 2
Reputation: 5165
There might be two possible approaches that you can take:
Upvotes: 5