Skip to content

Instantly share code, notes, and snippets.

@thetwopct
Last active September 1, 2021 05:50
Show Gist options
  • Save thetwopct/e350649b123779ca7cee6c0a9edb6872 to your computer and use it in GitHub Desktop.
Save thetwopct/e350649b123779ca7cee6c0a9edb6872 to your computer and use it in GitHub Desktop.
Useful Docker Commands
# display the logs of a container
docker logs
# continue showing log updates
docker logs -f mycontainer
# lists the volumes
docker volume ls
# stops all running containers
docker stop $(docker ps -a -q)
# kill all running containers
docker kill $(docker ps -q)
# update and stop a container that is in a crash-loop
docker update --restart=no && docker stop
# get container size and resource usage
docker ps -s
# get docker container disk utilization
docker system df
# remove local container images that are not used by any container and are not tagged
# (A pretty safe command to clean up your local filesystem)
docker image prune
# clean up and DELETE container images
docker image prune -a
# clean up and DELETE container images over a week ago
docker image prune -a --filter "until=168h"
# reset DNS locally (lando/docker can mess with https/http resolution)
sudo killall -HUP mDNSResponder
# remove HSTS redirect issues for localhost (Safari)
command + ,
Privacy -> Manage Website Data...
Search localhost
Click Remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment