Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make --rm flag default for fig run #943

Closed
wiktor-obrebski opened this issue Feb 11, 2015 · 15 comments
Closed

Make --rm flag default for fig run #943

wiktor-obrebski opened this issue Feb 11, 2015 · 15 comments

Comments

@wiktor-obrebski
Copy link

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.

@kojiromike
Copy link

👍 (but I would prefer --keep to --no-*)

@aanand
Copy link

aanand commented Feb 13, 2015

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.

@Starefossen
Copy link

+1 to default --rm and optional --no-rm for next major version increment!

@schmunk42
Copy link

👍

5 similar comments
@ssreekanth
Copy link

👍

@taiidani
Copy link

👍

@hugochinchilla
Copy link

+1

@baptistedonaux
Copy link

+1

@gedimin45
Copy link

👍

@zedtux
Copy link

zedtux commented Jun 20, 2015

+1 !!

@dnephin
Copy link

dnephin commented Sep 4, 2015

I think defaulting to --rm may be confusing in some cases, because that's not the docker run default.

@Visgean
Copy link

Visgean commented Feb 13, 2016

Well this should be, at least, configurable in some way.

@shin-
Copy link

shin- commented Feb 13, 2018

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.

@shin- shin- closed this as completed Feb 13, 2018
@weibeld
Copy link

weibeld commented May 28, 2019

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[@]}"
}

@r-hoogenboom
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests