• build: docker build . -t <tag_name>

  • connect to a container: docker exec -it <container_name> bash

  • delete

    • delete all volumes: docker volume rm $(docker volume ls -q) - docker volume rm - docker volume ls

    • delete all: docker stop $(docker ps -aq) && docker rm $(docker ps -aq) && docker rmi $(docker images -q)

  • list containers - docker ps

    • list running containers: docker ps

    • list all containers: docker ps -a

  • prune

    • prune all images: docker image prune --all

    • system: docker system prune

    • system with images: docker system prune --all


  • set variables: ARG variable=value

  • use variables example: WORKDIR /home/$variable

  • optimization tools and how-tos:






  • store config in docker-compose.yml by defaut

  • start (build images before starting containers): docker-compose up --build - docker-compose up

    • add -d for detached mode

  • stop

  • validate and view compose file: docker-compose config - docker-compose config

Docker on Mac#

  • install docker with brew install docker

  • use colima: