將指定image從官網上pull下來
docker pull image:tag
顯示倉庫內所有的image
docker images
顯示所有container
docker ps -a
由指定image創建一container
docker create -it image:tag /bin/bash
創建一container並設定port forwarding,並讓container在背景執行
docker run -td --name container_name -p local_port:host_port image:tag
啟動指定container
docker start container_id
啟動並attach指定container
docker start -ai container_id
停止指定container
docker stop container_id
attach and execute command in the container
docker exec -it container_id /bin/bash
將檔案從Host端傳送至container內
docker cp local_path container_id:path
將檔案從container內傳送至Host端
docker cp container_id:path local_path
使用container創建一image
docker commit -m "commit message" container_id image_name:tag
匯出容器
docker export containter_id > export_name.tar
or
docker export container_id --output="export_name.tar"
匯入容器
cat import_file.tar | docker import - image:tag
or
docker import import_file.tar