Skip to content

docker rmi -f should always exit 0 #46

@danrue

Description

@danrue

I used 'docker rmi -f' in a script and expected it to behave like rm 's -f: If the container (or file) does not exist, still exit cleanly. For another example, mkdir -p is handy in shell scripts to idempotently make a directory tree whether or not it already exists, avoiding additional code to handle such cases.

For example:

$ docker rmi -f non-existant-image
Error response from daemon: No such image: non-existant-image:latest
$ echo $?
1
$ rm -f non-existant-file
$ echo $?
0

I'm not sure about the scope of this request (perhaps it also applies to docker rm), or the validity, but I did hear at Dockercon that you were interested in improving the developer experience no matter how small - and this would improve mine a little bit. Otherwise, I need to run "docker rmi -f imagename || true", or wrap it in a second docker call to make it conditional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions