'command' - works inside a container composer definition currently and from what I understand overrides the default cmd
Can you also pull it back out to the top level or host level?
This would allow scenarios that currently have to be managed outside of docker-compose.
e,g,
couchbase1:
container_name: couchbase1
image: couchbase/server:community-3.0.1
volumes:
- /opt/couchbase/node1:/opt/couchbase/var
net: none
command: pipework add br1 couchbase 192.168.1.[email protected]
That would of course make command a keyword at the top level, but that's a small sacrifice and should be fairly easy to implement.
Unless someone has a better idea.
I don't think I understand the issue.
command
is always run in a container. docker-compose
is not a tool for running commands on the host.
If you need to run something on the host there are many tools to accomplish that task. Makefiles and bash scripts are probably the most common.
Sure, it just means I'm adding another tool to do what docker-compose could do to help set up arbitrary config... I guess the only use case I can see right now is pipework or manual configuration of the network since docker still isn't quite there yet.
This sounds more like the "hooks" feature that people have requested in the past, e.g. #1341. The proposed functionality in #1510 is the front-runner for solving this class of problem.
Ahh right, that's basically what I'd like. Closing this then.
I have a use case.
In dev, I need to start a database container but not on live. In dev, the database container needs to have it's data loaded from the host AFTER IT STARTS. If I bring it up beforehand and get it ready then I have to fight the networking between the containers to work properly because docker compose is setting up a network that does not exist before running 'up'. It would be useful for compose to do everything.
Any other ideas are also appreciated.
Most helpful comment
I don't think I understand the issue.
command
is always run in a container.docker-compose
is not a tool for running commands on the host.If you need to run something on the host there are many tools to accomplish that task. Makefiles and bash scripts are probably the most common.