Docker Command Cheat Sheet for Beginners
This guide provides an overview of essential Docker commands with explanations in Vietnamese. Use this as a quick reference for Docker operations.
Basic Docker Commands
| Command | Description (English) | Description (Vietnamese) |
|---|---|---|
| docker search IMAGE_NAME | Search for an image on Docker Hub. | Tìm image trên Docker Hub. |
| docker pull IMAGE_NAME | Download an image from Docker Hub. | Tải về image từ Docker Hub. |
| docker images | List all available images. | Liệt kê các hình ảnh đã tải về. |
| docker ps -a | List all containers (running and stopped). | Liệt kê các container. |
| docker start ID/CONT_NAME | Start a container. | Khởi động container. |
| docker stop ID/CONT_NAME | Stop a running container. | Dừng container đang chạy. |
| docker rm ID/NAME_CONT | Delete a container. | Xóa một container. |
| docker rmi ID/IMAGE_CONT | Remove an image. | Xóa một hình ảnh. |
Container Management Commands
| Command | Description (English) | Description (Vietnamese) |
|---|---|---|
| docker attach ID/CONT_NAME | Attach to a running container’s terminal. | Truy cập vào terminal của container đang chạy. |
| docker exec -it ID bash | Run a command in a running container. | Chạy lệnh trong container đang chạy. |
| docker save --output file-name.tar ID | Save an image to a file. | Xuất image ra file. |
| docker load < file-name.tar | Load an image from a file. | Tải image từ file. |
Container Creation Commands
| Command | Description (English) | Description (Vietnamese) |
|---|---|---|
| docker run -it --name NAME -p PORT:HOST --name | Create and run a new container with specified name and port mapping. | Tạo và chạy container mới với tên và cổng chỉ định. |
| docker volume create NAME_DISK | Create a volume. | Tạo volume. |
| docker network create --driver bridge NAME_NETW | Create a new bridge network. | Tạo một mạng bridge mới. |
Volume and Network Management
| Command | Description (English) | Description (Vietnamese) |
|---|---|---|
| docker volume ls | List all volumes. | Liệt kê tất cả các volume. |
| docker volume inspect NAME_DISK | Inspect a volume. | Xem chi tiết của một volume. |
| docker network ls | List all networks. | Liệt kê tất cả các mạng. |
| docker network inspect NAME_NETW | Inspect a network. | Xem chi tiết của mạng. |
Additional Commands
| Command | Description (English) | Description (Vietnamese) |
|---|---|---|
| docker logs -f namecont | Follow the logs of a container. | Xem log của container. |
| docker stats | Display container resource usage statistics. | Xem thống kê tài nguyên container. |
| docker build -t image:v1 . | Build an image from a Dockerfile. | Tạo image từ Dockerfil |
