mvberg / ib-gateway-docker

Interactive Brokers Trading Gateway running in Docker
MIT License
227 stars 105 forks source link

Running docker without docker-compose #13

Open romanrdgz opened 5 years ago

romanrdgz commented 5 years ago

I'm a bit new to docker, so this might be a silly question.

I would like to run and stop this docker container from a python code (this code handles an HTTP server, so I can turn on/off the gateway when I want for security). I tried docker official library for python, but it does not handle docker-compose, which is the recommended method here to run the container instead of docker run.

Is it possible to do this? Or is there any limitation here, due to a stacked nature of this container?

krumware commented 5 years ago

docker-compose itself is a python application that uses the docker API. It was recommended here only because it is a more convenient (and easier to read) method of specifying the required environmental variables and recommended volume mounts. You should be able to accomplish the same manner of running the application using a standard docker run command or otherwise, have at it! However, I must mention that in an orchestrated environment where you may ship this docker container (rancher, kubernetes, etc), your python script may add unnecessary complexity if you're hitting docker directly. You may consider leveraging functionality or APIs built into your orchestrator of choice instead of rolling your own.