docker常用操作
保存镜像:
# step1: commit container
docker commit -a "xiaobo" -m "ground_aware_env" 00e037a9d444 tensorrt7.1:ground_aware_plugin #commit container
docker commit --help
-a, --author string Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
-c, --change list Apply Dockerfile instruction to the created image
-m, --message string Commit message
-p, --pause Pause container during commit (default true)
# step2: save image
docker save -o xxxx.tar imageID # 用docker images命令查看step1中提交的镜像ID
docker save --help
Usage: docker save [OPTIONS] IMAGE [IMAGE...]
Save one or more images to a tar archive (streamed to STDOUT by default)
Options:
-o, --output string Write to a file, instead of STDOUT
删除容器或镜像:
docker rm -f $container_name
docker rmi -f $image_name
复制docker内的文件到本机上
docker cp [-r] [countiner name/id]:[docker内路径] [本机路径]