[container_id]with the numeric ID of the container from your list.
sudoprefix before both
dockercommands when stopping all containers (
sudo docker container stop $(sudo docker container ls –aq) )
container stopcommand and stops all the containers.
&&attribute instructs Docker to remove all stopped containers and volumes.
–afindicates this should apply to all containers (
a) without a required confirmation (
!=command is a logical notation that means “not equal to.”
[image_id2]with the image ID you pulled from the first command. You can enter a single Image ID, or multiple IDs for removal.
label. Still, these are powerful tools for managing Docker resources.
untilfilter to remove all resources up to a given time.
(–a)images created over the last 24 hours. The command can be used for containers, images, and filters. Make sure to specify the asset you want to remove.
untilcommand accepts Unix timestamps, date-formatted timestamps, or an amount of time (30m, 4h, 2h25m) calculated against the machine time.
labelcommand to remove assets defined by labels.
VolumeNamewith the actual name you generated with the previous command.
prunecommand removes all unused networks.
[networkID]with the ID you captured from the first command.
prunecommand automatically removes all resources that aren’t associated with a container. This is a streamlined way to clean up unused images, containers, volumes, and networks.
–aTo include stopped containers and unused images
–fBypasses confirmation dialog
––volumesRemoves all unused volumes
docker system prune -aremoves both unused and dangling images . Images used in a container, either currently running or exited, will NOT be affected.
–adisplay all of a resource (including the ones that are stopped)
--quiet(display only the numeric ID)