# docker

docker

hello world

docker version
docker info
docker pull hello-world
docker image ls -a
docker container ls -a
docker run hello-world
docker ps                   # list running container
docker top <container>      # pipes internal top
docker rm <container>
docker rmi <images>
docker rm -f $(docker ps -a -q) # stop and remove all
docker run -it ubuntu bash      # start image
docker exec -it <container> sh  # give interacive shell in running container
docker logs <container>         # show stdout/stderr (?) of running processes
docker system prune -a          # `--all` includes images

dockerfile

file lives in own dir, build w/:

docker build <dirname>
docker build <dirname> -t <name>:<tag>
docker history <image>

docker compose

configures one or more docker containers and one or more networks. images are usually referenced by their name:tag given on build w/ -t. can handle multiple containers in multiple networks and up/down them all in one go.

all before : is host, all after is in docker.

docker-compose up
docker-compose down     # all data inside container will be lost
docker-compose pause    # data will be retained, will be resumed on host reboot
docker-compose unpause <id>
docker-compose ps       # like `docker ps`, but with grouping
docker-compose logs
docker-compose run <id> bash    # interactive shell using docker-compose settings

storage

julian says: also check named volumes in gitea doc.

history / buzzwording