Open thanhduongvs opened 1 month ago
docker -v
docker images --help
docker images
docker search ubuntu
docker pull ubuntu:18.04
docker image rm ubuntu:18.04
docker image rm f9a80
docker run -it ubuntu:18.04
exit
docker ps
docker ps -a
docker start hala
docker attach hala
docker stop hala
docker run -it --name "yocto" -h vanson ubuntu:18.04
docker start yocto
docker exec yocto ls
docker commit yocto ubuntu-yocto:dunfell
docker save --output myname.tar ubuntu-yocto:dunfell
docker load -i myname.tar
docker tag fa92 ubuntu-yocto:dunfell
docker run -it -v /home/vanson/working:/home/working ubuntu:18.04 tạo container mới được ánh xạ thư mục
docker run -it -v /home/vanson/working:/home/working ubuntu:18.04
docker run -it -v /home/vanson/working:/home/working --name dunfell ubuntu:18.04 tạo container mới có tên dunfell từ image ubuntu18.04, có ánh xạ
docker run -it -v /home/vanson/working:/home/working --name dunfell ubuntu:18.04
sudo groupadd docker
sudo usermod -aG docker ${USER}
sudo chmod 666 /var/run/docker.sock
sudo systemctl restart docker
dockder
1
docker -v
- xem versiondocker images --help
- xem các lệnh con có trong imagedocker images
- danh sách các đang có imagedocker search ubuntu
- tìm kiếm image có têndocker pull ubuntu:18.04
tải ubuntu 18.04docker image rm ubuntu:18.04
xóa image theo têndocker image rm f9a80
xóa image theo iddocker run -it ubuntu:18.04
chạy container từ image ubuntu 18.04exit
để thoát ra khỏi container đó, và dừng container đódocker ps
xem container nào đang chạydocker ps -a
xem tất cả các container kể cả không chạydocker start hala
chạy container có tên là haladocker attach hala
vào lại terminal của container đang chạy hala, từ máy hostdocker stop hala
để dừng container hala từ máy hostdocker run -it --name "yocto" -h vanson ubuntu:18.04
tạo container có tên là yocto, có hostname là vanson từ image ubuntu 18.04docker start yocto
để chạy lại container yocto vừa tạo2
docker exec yocto ls
chạy command ls từ máy host vào container yocto đang chạydocker commit yocto ubuntu-yocto:dunfell
lưu container yocto thành image có tên là ubuntu-yocto có tag là dunfelldocker save --output myname.tar ubuntu-yocto:dunfell
lưu image ubuntu-yocto:dunfell có tên myname.tardocker load -i myname.tar
tải lại image myname.tar vừa lưudocker tag fa92 ubuntu-yocto:dunfell
đặt lại tên image và tag cho image vừa load3
docker run -it -v /home/vanson/working:/home/working ubuntu:18.04
tạo container mới được ánh xạ thư mụcdocker run -it -v /home/vanson/working:/home/working --name dunfell ubuntu:18.04
tạo container mới có tên dunfell từ image ubuntu18.04, có ánh xạERROR: Got permission denied while trying to connect to the
sudo groupadd docker
sudo usermod -aG docker ${USER}
sudo chmod 666 /var/run/docker.sock
sudo systemctl restart docker