skip to Main Content

is there any way to determine whether or not a container will be removed on exit with a docker container inspect $id command? Or any other docker command?

2

Answers


  1. Chosen as BEST ANSWER

    turns out the answer is yes, the particular field is .HostConfig.AutoRemove, so for example:

    docker inspect --format='{{.HostConfig.AutoRemove}}' $id
    

  2. The command provided by @Dave Ankin will output either true or false. If it’s true, the container will be automatically removed on exit. If it’s false, the container will not be automatically removed.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search