why --rm is not default for fig run? I find containers created by run often useless. Maybe it could be some 'no-rm' flag instead of --rm ?
People who I presents fig are confused by this flag.
:+1: (but I would prefer --keep to --no-*)
It's not the default because that would've been a breaking change.
We could make it the default for the next version increment. --no-rm would be consistent with other flags.
+1 to default --rm and optional --no-rm for next major version increment!
:+1:
:+1:
:+1:
+1
+1
:+1:
+1 !!
I think defaulting to --rm may be confusing in some cases, because that's not the docker run default.
Well this should be, at least, configurable in some way.
I don't think we're looking to change the default behavior of run anymore at this point - #3178 should mitigate the pain on this though.
A workaround for docker is the following Bash function that sets --rm for any docker run and docker container run command:
docker() {
local args=("$@")
if [[ "$1" = run ]]; then
args=(run --rm "${args[@]:1}")
elif [[ "$1" = container && "$2" = run ]]; then
args=(container run --rm "${args[@]:2}")
fi
command docker "${args[@]}"
}
If you don't want the --rm flag for a specific command, you can run command docker run <...> in order to invoke the actual docker command and not the Bash function.
The above is for docker, but of course you can do the same for docker-compose:
docker-compose() {
local args=("$@")
if [[ "$1" = run ]]; then
args=(run --rm "${args[@]:1}")
fi
command docker-compose "${args[@]}"
}
This is nice (albeit quirky) for when you're on linux where bash is the default shell, but cmd.exe doesn't have such facility.
I don't understand why this cannot be put in the config file of docker for instance (look at git). Everybody is talking about not breaking current behavior; so make it persist-able for people who don't care about such backward compatibility and just want 'sane' behavior.
Or at least create a short option for --rm, so that is can be merged in the options your fingers automatically type. Something like -r, so that 'docker run -rit' becomes the standard, which nobody actually needs to know what the letters mean, because it just does what you want.