Skip to content

Instantly share code, notes, and snippets.

@AkiraBrand
Last active October 14, 2021 14:40
Show Gist options
  • Save AkiraBrand/61d40ce6d5c4fe83466fb7f8bddee086 to your computer and use it in GitHub Desktop.
Save AkiraBrand/61d40ce6d5c4fe83466fb7f8bddee086 to your computer and use it in GitHub Desktop.
  • List all docker containers

docker container ls -a

  • List port mappings or a specific mapping for the container -> see the port to your pg instance exposed from whichever db container I want to connect to

docker port <db container id>

  • Remove the volumes

docker compose down -v 

  • Prune the system

docker system prune -af 

  • Not docker, but useful to see all open files

lsof -i 

  • Show running containers

docker ps

  • Shows running and stopped containers

docker ps -a

*maybe of note: docker compose down is to spin down docker-compose.yml and when you do docker compose down -v it removes volumes as it spins down..

docker compose up spin up docker-compose.yml

  • remove volumes not used by a container if you forget the -v

docker volume prune

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment