Docker rm: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=


* [[Docker_Client_Operations#Lifecycle|Client Operations]]
* [[Docker_Client_Operations#Remove_a_Container|Container Lifecycle Operations]]


=Overview=
=Overview=
Line 8: Line 8:


A running container cannot be removed unless [[Docker_rm#-f.2C_--force|-f]] is used.
A running container cannot be removed unless [[Docker_rm#-f.2C_--force|-f]] is used.
Once deleted, a container discards its [[Docker_Concepts#Difference_Between_Containers_and_Images_-_a_Writable_Layer|writable layer]] so the state maintained there from previous runs is lost. The base image is not modified.


=Options=
=Options=


==-f, --force==
==-f, --force==
Force the removal of a running container (uses SIGKILL).
=Remove Exited Containers=
docker rm $(docker ps --filter "status=exited" -q --no-trunc)
Also see [[Docker_ps#Exited_Containers|docker ps]].

Latest revision as of 01:05, 31 January 2018

Internal

Overview

docker rm <options> <container-id>

A running container cannot be removed unless -f is used.

Once deleted, a container discards its writable layer so the state maintained there from previous runs is lost. The base image is not modified.

Options

-f, --force

Force the removal of a running container (uses SIGKILL).

Remove Exited Containers

docker rm $(docker ps --filter "status=exited" -q --no-trunc)

Also see docker ps.