Skip to content

Instantly share code, notes, and snippets.

@verticalgrain
Last active May 27, 2019 17:04
Show Gist options
  • Save verticalgrain/31e91c709c57f65c3797e95af17764d4 to your computer and use it in GitHub Desktop.
Save verticalgrain/31e91c709c57f65c3797e95af17764d4 to your computer and use it in GitHub Desktop.
Docker Gist
// clean cache and do some ot her scary stuff
docker system prune -a
// List all containers (only IDs)
docker ps -aq.
// Stop all running containers.
docker stop $(docker ps -a -q)
// Remove all containers.
docker rm $(docker ps -a -q)
// Remove all images.
docker rmi $(docker images -q)
// Start container
docker container start containername
// SSH Into container
docker exec -it containername /bin/bash
// Start docker machine
eval $(docker-machine env default)
docker-machine ls
//
// Copy to and from docker machine
docker cp foo.txt mycontainer:/foo.txt
docker cp mycontainer:/foo.txt foo.txt
docker cp src/. mycontainer:/target
docker cp mycontainer:/src/. target
// List running containers
docker container ls
// Check container status
docker-compose ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment