til/Development/Docker.md

1.9 KiB

Docker

Distribution Package
Arch Linux docker docker-compose
Debian See
Ubuntu See
Fedor See

Enable and start service:

systemctl enable --now docker.service

Add your user to docker group:

sudo usermod -aG docker $USER

Commands

Remove unused data:

docker system prune --volumes

docker system prune --volumes -a

Inside container:

docker exec -it container_name /bin/bash

Docker run options:

option example explain
--detach, -d Run container in background
--env, -e -e PLATFORM=linux Set environment variables
--interactive, -i Keep STDIN open
--name
--publish, -p -p 8080:80 Publish container port:host port
--rm Remove container when exit
--tty, -t Allocate a pseudo-TTY
--volume, -v -v "$(pwd)"/data:/data Bind host directory:container directory

Docker Compose

Update images:

docker-compose pull

Start:

docker-compose up

# Detach
docker-compose up -d

Stops:

docker-compose down