docker:保存容器为镜像文件

root@localhost:/var/lib/docker# docker ps -a

CONTAINER ID   IMAGE            COMMAND       CREATED      STATUS                  PORTS     NAMES

81baec32cad4   fbubuntu:20.04   "/bin/bash"   4 days ago   Up 46 hours                       root_fbubuntu_lsdk2108_0c1bc7

bb30c257f8a8   fbubuntu:20.04   "/bin/bash"   5 days ago   Exited (2) 2 days ago             ricky_fbubuntu_lsdk2108_0c1bc7

docker commit -a hanzhiguang -m "lsdk21.08_ls1046ardb" 81baec32cad4 lsdk2108:ls1046

docker save -o lsdk2108_ls1046.tar  lsdk2108:ls1046

或者直接生成压缩包:

docker save  lsdk2108:ls1046 | gzip > lsdk2108_ls1046.tar.gz

你可能感兴趣的:(docker,java,容器)