docker rm
Deletes a stopped container and its writable layer; the image stays.
In more detail
Add -f (force) to kill and remove a running container in one step, as an emergency shortcut rather than the normal path. Removing a container never deletes its image or named volumes; use docker image rm or docker volume rm for those.
Examples
docker rm -f note-one note-twodocker rm -f m01l03-brokerRelated terms
- docker image rm — Deletes an image from your machine.
- writable layer — The thin layer on top of an image where a running container writes its changes.
- --rm — A docker run flag that deletes the container automatically as soon as it exits.
- container lifecycle — The stages a container passes through: created, running, paused, stopped (exited) and removed.
- docker run — Creates a new container from an image and starts it, in one step.
- docker stop — Asks a running container to shut down cleanly, then forces it if it does not.
Taught in
- Union Filesystems, Images And Writable Layers — Docker Architecture & Production Containers
- Run, Stop, Restart And Remove A Container — Docker Architecture & Production Containers
- Commands, Logs, Exec And Exit Codes — Docker Architecture & Production Containers
- ARG, ENV, LABEL, EXPOSE And VOLUME — Docker Architecture & Production Containers
- CMD, ENTRYPOINT, USER And Process Signals — Docker Architecture & Production Containers
- Authenticate, Tag, Push And Pull From A Registry — Docker Architecture & Production Containers
- Scan, Patch And Inspect The Software Supply Chain — Docker Architecture & Production Containers
- Ephemeral Filesystems And Named Volumes — Docker Architecture & Production Containers
- Bind Mounts, Permissions And Backups — Docker Architecture & Production Containers
- Bridge Networks, DNS And Container Communication — Docker Architecture & Production Containers
- Port Publishing, Localhost And Network Troubleshooting — Docker Architecture & Production Containers
- Environment, Secret Files And Runtime Restrictions — Docker Architecture & Production Containers
- Health Checks, Dependencies And Reliable Startup — Docker Architecture & Production Containers
- Diagnose Crashes, Resource Limits And Unhealthy Containers — Docker Architecture & Production Containers
- Build, Test And Promote The Same Image In CI — Docker Architecture & Production Containers
- Topics, Partitions And Where A Record Lands — Apache Kafka & Event Streaming
- Retention: Time, Size And Why Data Stays — Apache Kafka & Event Streaming
- Losing A Broker — Apache Kafka & Event Streaming