Skip to content

Instantly share code, notes, and snippets.

@noelworden
Last active August 8, 2020 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noelworden/33e0c7e4ed9f33ab0d6e1a37402a7bdd to your computer and use it in GitHub Desktop.
Save noelworden/33e0c7e4ed9f33ab0d6e1a37402a7bdd to your computer and use it in GitHub Desktop.
#helpers

Whats what

  • Dockerfile builds an image
  • A container is started from that image
  • Multiple containers can be started and running simultaneously from a single image

Frequently used commands

  • enter a docker bash session
    • use docker ps -a to see all containers
    • get NAME of desired container
    • enter the bash session
      • docker exec -t -i <container name> /bin/bash
  • another way to enter bash session
    • docker-compose exec <container name sh
  • third way to enter a bash session
    • docker-compose run <containter name> bash
  • docker ps
    • shows all running containers
  • docker ps -a
    • shows all containers, running or not
  • docker inspect --format "{{.State.Running}}" wp
    • wp is name of container
    • shows boolean if container is running
  • docker logs <container name>
  • docker stop $(docker ps -a -q)
    • stop all running containers

Docker space issue

https://forums.docker.com/t/docker-doesnt-release-disk-space-used-by-library-containers-com-docker-docker/15194

Prune docker from harddrive

docker image prune

https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

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