从零开始配置kali2023环境:镜像保存和导入
2024-01-02 08:06:23
对原始的镜像做了一些改动,然后把当前容器状态打包为新的镜像,这样以后可以部署到其他地方了,而不用再安装软件等改动等等
1.查看容器id
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker ?ps ?
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker ps
[sudo] password for holyeyes:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97ff203f6ebe fzinfz/anaconda3 "/bin/bash" 2 hours ago Up 2 hours 2222/tcp, 0.0.0.0:12345->8888/tcp, :::12345->8888/tcp Anaconda-jupyter
21c00dd385bc skysider/pwndocker "/sbin/my_init" 3 hours ago Up 3 hours 0.0.0.0:23946->23946/tcp, :::23946->23946/tcp pwn_test
2.修改容器名称
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker rename 97ff203f6ebe Anaconda-jupyter
?
──(holyeyes?kali2023)-[~]
└─$ sudo docker rename 97ff203f6ebe Anaconda-jupyter
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97ff203f6ebe fzinfz/anaconda3 "/bin/bash" 2 hours ago Up 2 hours 2222/tcp, 0.0.0.0:12345->8888/tcp, :::12345->8888/tcp Anaconda-jupyter
21c00dd385bc skysider/pwndocker "/sbin/my_init" 3 hours ago Up 3 hours 0.0.0.0:23946->23946/tcp, :::23946->23946/tcp pwn_test
3.保存容器为镜像
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker commit 97ff203f6ebe anaconda-jupyter:v0.1
sha256:67fd440eb24f75042cfef32df09e130a626b6d28b67f31603346f089e3cbcc1f
?
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker commit 97ff203f6ebe anaconda-jupyter:v0.1
sha256:67fd440eb24f75042cfef32df09e130a626b6d28b67f31603346f089e3cbcc1f
──(holyeyes?kali2023)-[~]
└─$ sudo docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
anaconda-jupyter v0.1 67fd440eb24f About a minute ago 4.09GB
skysider/pwndocker latest 26c0315bd8d9 2 months ago 5GB
fzinfz/anaconda3 latest b04d5f54948b 3 years ago 4.08GB
4.导出镜像
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker save -o ?anaconda-jupyter.tar 67fd440eb24f
┌──(holyeyes?kali2023)-[~]
└─$ sudo docker save -o anaconda-jupyter.tar 67fd440eb24f
┌──(holyeyes?kali2023)-[~]
└─$ ls
Anaconda2-5.3.1-Linux-x86_64.sh Pictures get-pip.py
Anaconda3-2023.09-0-Linux-x86_64.sh Public microsoft.gpg
Desktop Re output
Documents Templates pwndocker
Downloads Videos utf9
Misc anaconda-jupyter.tar
Music anaconda3
┌──(holyeyes?kali2023)-[~]
└─$ ll
total 5846088
-rwxrw-rw- 1 holyeyes holyeyes 647814227 Dec 18 23:50 Anaconda2-5.3.1-Linux-x86_64.sh
-rwxrw-rw- 1 holyeyes holyeyes 1153404010 Nov 26 19:36 Anaconda3-2023.09-0-Linux-x86_64.sh
drwxr-xr-x 2 holyeyes holyeyes 4096 Nov 25 13:44 Desktop
drwxr-xr-x 2 holyeyes holyeyes 4096 Nov 25 13:44 Documents
drwxr-xr-x 2 holyeyes holyeyes 4096 Dec 4 20:36 Downloads
drwxr-xr-x 6 holyeyes holyeyes 4096 Dec 10 21:14 Misc
drwxr-xr-x 2 holyeyes holyeyes 4096 Nov 25 13:44 Music
drwxr-xr-x 2 holyeyes holyeyes 4096 Dec 16 16:24 Pictures
drwxr-xr-x 2 holyeyes holyeyes 4096 Nov 25 13:44 Public
drwxr-xr-x 2 holyeyes holyeyes 4096 Dec 31 13:05 Re
drwxr-xr-x 2 holyeyes holyeyes 4096 Nov 25 13:44 Templates
drwxr-xr-x 2 holyeyes holyeyes 4096 Nov 25 13:44 Videos
-rw------- 1 root root 4183187968 Dec 31 16:49 anaconda-jupyter.tar
drwxr-xr-x 32 holyeyes holyeyes 4096 Dec 20 21:19 anaconda3
-rw-r--r-- 1 holyeyes holyeyes 1908226 Feb 23 2021 get-pip.py
-rw-r--r-- 1 holyeyes holyeyes 641 Nov 26 18:33 microsoft.gpg
drwxr-xr-- 2 holyeyes holyeyes 4096 Dec 3 11:18 output
drwxr-xr-x 4 holyeyes holyeyes 4096 Dec 31 12:13 pwndocker
drwxr-xr-x 7 holyeyes holyeyes 4096 Dec 18 22:13 utf9
┌──(holyeyes?kali2023)-[~]
└─$
5.导入镜像
sudo docker load -i anaconda-jupyter.tar
文章来源:https://blog.csdn.net/weixin_44626085/article/details/135317458
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!