Skip to content

A container's life: create, start, pause, stop, remove

Select an icon to see what it is.

Step 6 of 6

rm: the container is deleted

A running container must be stopped first. DELETE /containers/{id} then removes its metadata and its writable layer under /var/lib/docker. Volumes are kept unless you ask for them to go.

$ docker rm -f web
PrevNext

DELETE /v1.45/containers/d4e5f6a7b8c9d0e1d4e5f6a7b8c9d0e1d4e5f6a7b8c9d0e1d4e5f6a7b8c9d0e1?force=1

force=1 kills a running container with SIGKILL, then removes it

Try it yourself

Walk one container through its states and read State after each step.

$ docker create --name web nginx
$ docker inspect --format '{{.State.Status}}' web
$ docker start web
$ docker pause web
$ docker unpause web
$ docker stop web
$ docker inspect --format '{{.State.Status}} {{.State.ExitCode}}' web
$ docker rm web

Quiz

1. Which state does a container have right after docker create?
2. What does docker pause do?
3. What happens if a container ignores the stop signal?