Open chrissinclairedited opened 5 years ago
Ahhh! --remove-orphans
is a docker-compose
thing - was wondering why I couldn't find it anywhere. In this case we're simply forwarding the output from docker which isn't great.
We can certainly add it - does it make sense to add to every command (up/start/stop/restart/reload/destroy)?
Hmmm what does docker-compose
do? If it allows it on all commands I'd be inclined to replicate that behaviour.
So ktd destroy
will do this! https://github.com/EDITD/kubetools-client/blob/develop/kubetools_client/dev/container_util.py#L209
Agreed we should make it consistent with compose (also destroy
vs down
- though IMO compose's use of down
is stupid/confusing).
Ah that's interesting - just confusing that currently the docker-compose output asks for the --remove-orphans
flag, but passing that to ktd destroy
gives an error!
Agree that docker-compose down
is a confusing command - destroy
definitely better conveys what's going to happen (even if down
is the opposite of up
).
@chrissinclairedited agreed!
Wonder if we can hook into the output of compose and remove/replace those lines. Maybe it's just easier to add --remove-orphans
to up
/destroy
which map to the compose commands.
Hmmm possibly - might be a bit awkward to filter out just those messages (I'm guessing you'd have to hook into the stdout / stderr stream from the compose process, and then be clever about stripping out just that text whilst respecting all the various control characters docker-compose uses).
TBH it might be easier to check if there are any orphans and if so present a ktd
generated message explaining what's happening?
I've got a kubetools.yml config file, where I've now changed a container from being
dev: true
to only being deployed in the production namespace & environment. This has left me with some orphaned containers.ktd reload
spots this and suggests using the--remove-orphans
flag to tidy them up:However running that gives me a
no such option
error: