Created
April 17, 2024 11:07
-
-
Save oreillyross/e8c745bee20bddaa008df59a7728343e to your computer and use it in GitHub Desktop.
The general Docker run command with flags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -d p <host-port>:<container-port> -e <name>=<value> <image-name> |
Cleaning up everything all at once
Need a way to nuke all Docker containers and images at once? A few steps are
involved in doing this. The following commands work on macOS, Linux, and the WSL2
Linux terminal under Windows (but not under Windows Terminal).
First, stop and remove all containers:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
Then, run the prune command with the following options to remove everything else:
docker system prune --volumes --all
This will remove all cached images on your computer. Be prepared to wait a lot longer
for all subsequent Docker builds because it will download all the base images into your
local cache again.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker rm <container-id>