docker / docker/cli

Allow setting AutoRemove (`--rm`) by default in `config.json`

Open
#4,763 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/runtime area/ux kind/feature status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

As a user, i'd like to be able to set something like "autoRemove": true in my ~/.docker/config.json file, so that i can run a command as follows:

docker run -it debian

...and have it be equivalent to:

docker run --rm -it debian

Because i always forget the --rm flag, and end up with hundreds of dangling containers in my Docker dashboard.

I'm not proposing changing the default, just allowing me a persistent way to set the flag. I've had a look at the source and i don't believe there's any environment variable that i could set that would have this effect.

I'll open a small PR that enables the feature i suggest, but i'm sure it won't be ready as-is, because i'll have forgotten cases or whatever, but i'd like to have a starting point for the discussion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing the Docker CLI's run command and its ~/.docker/config.json loading, then determine where a persistent --rm setting would apply. Done means "autoRemove": true makes docker run -it debian equivalent to docker run --rm -it debian without changing the default for other users.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.