Skip to content

Instantly share code, notes, and snippets.

@ConorSheehan1
Last active August 27, 2020 13:19
Show Gist options
  • Save ConorSheehan1/f0bc0b879b022f1a84a657571fe17006 to your computer and use it in GitHub Desktop.
Save ConorSheehan1/f0bc0b879b022f1a84a657571fe17006 to your computer and use it in GitHub Desktop.
docker commands

Commands

# start container, attach stdin, use psuedo tty, use host network
docker run -it --network=host ubuntu:16.04  

# Delete all containers
docker rm $(docker ps -aq)  

# Delete all images  
docker rmi $(docker images -q)  

# Delete all untagged images**  
docker rmi $(docker images -q --filter "dangling=true")

# Remove all unused containers, networks, images
docker system prune

# Restart unhealthy containers
docker restart $(docker ps -q --filter "health=unhealthy")

Debuggins

# if apt-get install doesn't work, it may not be a network issue re: https://github.com/moby/moby/issues/866#issuecomment-19218300
# try the following:

apt-get update
apt-get install net-tools

Notes

-q == --quiet # return ids only 
-t # pseudo tty (interactive shell)  
-i # bind stdin 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment