Docker
Testing Dockerfile
setups¶
To quickly verify whether a Dockerfile is properly configured, try independently running
docker build
outside of docker compose.
For example, with the Api.Dockerfile:
docker build -t <image_name> -f <dockerfile_path> .
Docker Commands¶
docker exec -it [CONTAINER_ID] /bin/bash
or/bin/sh
to get terminal a containerdocker ps
lists running containers, their status, and ports- Remove 'everything' in Docker (images, etc.):
docker system prune -a
- Remove all containers:
docker container prune
- Remove all volumes:
docker volume prune
- Remove all 'dangling' images:
docker rmi $(docker images -f "dangling=true" -q)
- List containers:
docker container ps --all
- Stop container:
docker stop <container-id>
- Delete stopped container:
docker rm <container-id>
- List images:
docker images
- Delete image:
docker image rm <image-id>
- Docker Compose Anchors and Extensions
Docker Compose¶
Docker compose 2 looks for docker-compose.yml
to begin orchestration. However, it then
also looks at docker-compose.override.yml
to override/merge the settings from the base
configuration. See the merge compose files
documentation for the detailed rules on how this happens.