- 镜像搜索、拉取和使用
1
2
3
4
5
6docker search ubuntu
docker pull ubuntu
docker run -it --name test ubuntu /bin/bash
docker start test
docker restart test
docker stop test - 将容器保存为镜像,便于重复使用
1
2
3
4
5apt-get install net-tools
apt-get install -y inetutils-ping
apt-get install iproute2
docker commit -a "作者名" -m "镜像描述" 容器ID 新镜像命名
docker commit -a "paxton" -m "ubuntu with modified apt source.list" ovs1 mdubuntu - 自定义网络
- docker的网络通信基于安装时新建的docker0网桥,可以与外网,本虚拟机以及其他虚拟机通信
- 在两台虚拟机上创建自定义网络,并为新建容器分配自定义网络下的ip地址,两台虚拟机分配不同网段,配置操作如下:
虚拟机1-ip:192.168.255.129 容器网段 10.0.30.0/24 容器ip:10.0.30.10
虚拟机1操作如下:
创建自定义网络,ifconfig可发现多出一个网桥
1 | ## h0 |
此时,新建的两个虚拟机相互无法ping通。可以通过增加路由的方式解决:
1 | ip route show # 查看一下当前路由 |
https://www.cnblogs.com/tengj/p/5357879.html
https://blog.csdn.net/Silvester123/article/details/80867168