启动Docker
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
db70bb3f6068 centos "/bin/bash" 27 hours ago Exited (0) 27 hours ago serene_wright
[root@localhost ~]# docker start db70bb3f6068
db70bb3f6068
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
db70bb3f6068 centos "/bin/bash" 28 hours ago Up 55 minutes serene_wright
[root@localhost ~]# docker exec -it db70bb3f6068 /bin/bash
[root@db70bb3f6068 /]#
更改
[root@db70bb3f6068 /]# wget
bash: wget: command not found
[root@db70bb3f6068 /]# yum install -y net-tools wget
提交新镜像
[root@db70bb3f6068 /]# exit
exit
[root@localhost ~]# docker commit -m "cantos_with_nettools_and_wget" -a "root" db70bb3f6068 centos_with_net
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos_with_net latest 3e8ea8607f08 24 seconds ago 294.9 MB
centos latest 9baab0af79c4 9 days ago 196.7 MB
本文介绍如何在Docker容器内启动并安装NetTools及Wget等网络工具,通过具体步骤演示了从创建容器到安装所需软件包的过程,并最终提交为新的镜像。
647

被折叠的 条评论
为什么被折叠?



