Anh Dũng ơi, docker có thật sự quan trọng không ạ. Thông thường anh hay dùng những lệnh nào của docker ạ. Em cảm ơn
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Nói docker quan trọng thì anh cũng thấy đúng, tuy nhiên nó không phải là cái bắt buộc phải có. Hiện tại thì anh dùng docker cho:
– Kubernetes các dự án với k8s
– Integration test: anh dựng môi trường với mysql
– Đóng gói các tool để chạy cho nhanh
Các câu lệnh anh hay dùng:
1.
docker pull {image_name}
: Pull một image từ Docker Hub2.
docker images
: Liệt kê các images hiện có3.
docker rmi
{image_id/name}: Xóa một image4.
docker ps
: Liệt kê các container đang chạy5.
docker ps -a
: Liệt kê các container đã tắt6.
docker rm -f {container_id/name}
: Xóa một container7.
docker rename {old_container_name} {new_container_name}
: Đổi tên một container8.
docker start {new_container_name}
hoặcdocker exec -it {new_container_name} /bin/bash
: Khởi động một container9.
docker run --name {container_name} -p {host_port}:{container_port} -v {/host_path}:{/container_path} -it {image_name} /bin/bash
: Tạo mới một container, đồng thời khởi động với tùy chọn cổng và volume10.
docker diff {container_name}
: Xem các thay đổi trên container11.
docker commit -m "message" {container_name} {image_name}
: Commit các thay đổi trên container và image12.
docker save {image_name} > {/host_path/new_image.tar}
: Save image thành file .tar13.
cat musashi.tar | docker import - {new_image_name}:latest
: Tạo một image mới từ file .tar14.
docker history {image_name}
: Xem lịch sử các commit trên image15.
docker tag {iamge_id} {image_new_name}:{tag}
: Khôi phục lại images từ IMAGE_ID16.
docker build -t {container_name} .
: Build một image từ container