Closed tadamcz closed 8 months ago
I decided not to implement all possible docker and docker compose flags if they can be provided via an environment variable to keep this tool simple, would this work for your use case?
env DOCKER_CONTEXT=production docker rollout
(See Docker profiles https://github.com/Wowu/docker-rollout/issues/5#issuecomment-1501538614 and remote deployment https://github.com/Wowu/docker-rollout/issues/6#issuecomment-1503198297)
Yes this works OK.
I had thought you could just pass arbitrary additional flags to docker and compose as follows.
i.e.
docker --xyz rollout
passes xyz to docker
And docker rollout --xyz
passes xyz to compose
Actually, it sounds like a good idea to pass unknown flags, but there's a catch: the script uses docker
and docker compose
, and those have different flags available. I think environment variables are a nice solution, especially for a bash script tool.
Not sure I understand the problem; you could pass them like I described in the last comment? Is there something wrong with my suggestion?
Obviously the decision of how to spend your time is entirely yours. Thanks for the tool :)
Oh sorry, I didn't get your idea at first. Would be great, but I'm not sure if I'm able to access flags passed to docker commands, because the docker plugin integration is pretty basic. Will check
It works as I expected, thank you for the suggestion. Arguments before rollout
are now passed to docker
commands, so --context
now works.
Released as https://github.com/Wowu/docker-rollout/releases/tag/v0.6
Could you support the docker --context flag?
It's used like this, to take the example from the Docker docs:
I suppose you'd need to change something around here:
and here:
Shell scripting is not at all my strength so I'm hesitant to dive in myself.