Bảng tra cứu nhanh Docker & Compose
Quản lý container, build image, Dockerfile đa tầng, stack Compose v2, mạng, volume, đọc log và dọn dẹp an toàn trên Docker 27+.
Cách hoạt động
Images are immutable layered templates; containers are writable runtime processes from an image; volumes persist state across container replacement; networks wire service DNS.
Bộ lệnh sống còn
Vài lệnh nên học trước tiên.
42 lệnh
Run & Inspect Containers
Start containers, map ports, inspect logs, and attach interactive shells.
- Cơ bản
Start an ephemeral interactive container and delete it on exit
docker run --rm -it <image> <shell>Dựng lệnh
docker run --rm -it <image> <shell>Giá trị được chèn đúng như bạn nhập. Hãy tự đặt dấu nháy nếu giá trị có khoảng trắng hoặc ký tự đặc biệt.
Khi nào dùng
Best for throwaway debugging environments without leaving stopped containers behind.
Giải thích từng phần
- --rm
- Automatically remove container once it exits
- -it
- Interactive stdin (-i) + pseudo-TTY (-t)
Ví dụ
docker run --rm -it alpine:3.20 sh
Images & Multi-Platform Builds
Build, tag, inspect image layers, and manage local registries.
Docker Compose v2
Orchestrate multi-container local stacks cleanly with `docker compose`.
Volumes, Networks & Files
Persist database state, connect containers by service name, and copy files.
Disk Usage & Safe Cleanup
Measure disk consumption and prune unused objects without losing data.