Run with resource limits docker
Limit container to 512MB RAM and half a CPU core
docker run --memory=512m --cpus=0.5 --oom-kill-disable=false myapp
more docker
all 46 commands →
Show container resource usage
docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}'
Remove dangling images
docker image prune -f
Remove everything unused
docker system prune -a --volumes -f
Copy file from container
docker cp <container>:/app/config.yaml ./local-config.yaml
Docker compose up detached
docker compose up -d --build --remove-orphans