查看网卡
docker network ls
[root@localhost ~]# docker network ls
NETWORK ID NAME DRIVER SCOPE
dbf3f90adfca bridge bridge local
eb55ad4563fc host host local
3bd4041e15f4 none null local
45e27e5e1669 odc_loki bridge local
docker inspect odc_loki
[root@localhost ~]# docker network inspect odc_loki
[
{
"Name": "odc_loki",
"Id": "45e27e5e166966b70d48c65296476ef9e7489cbf953a7f41842d5338f446318a",
"Created": "2021-07-20T23:00:13.758871072-04:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"2b17eda54b7edc62f0faa0c275fdb6a38e873b4ec8354488baccd9454ff6db32": {
"Name": "odc_promtail_1",
"EndpointID": "775c9a2d204eaac7d4257be8f51494171609b723fecb85bc4695e8a17a9ed6b5",
"MacAddress": "02:42:ac:12:00:04",
"IPv4Address": "172.18.0.4/16",
"IPv6Address": ""
},
"41c4d962674047eca9707a5a44c346735dc496b5a931835996c1ec827fd1a3c3": {
"Name": "odc_loki_1",
"EndpointID": "1be519f8d6728d945e4d90c800499b221c83eace3a0fd4bc76c50dee7c0cc719",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
},
"c80c31e7153818e6440d67d82fa3981e274423b358a33fcee9e6e1bc759a023f": {
"Name": "odc_grafana_1",
"EndpointID": "c34c84badb34da0c92a05b33f4960a4a7ad12f2ade23f59a45259e277dcc5a5c",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "loki",
"com.docker.compose.project": "odc",
"com.docker.compose.version": "1.26.2"
}
}
]
docker 把容器打成镜像
docker commit [容器名称] [镜像名称]
查看内存资源
docker top [容器名]
docker stats [容器名]
工具:github搜索 weaveworks/scope
安装:
1.关闭所在机器防火请
2.安装
sudo curl -L git.io/scope -o /usr/local/bin/scope
sudo chmod a+x /usr/local/bin/scope
scope launch
scope launch ip1 ip2
3.打开web浏览器访问
http://localhost:4040.
二、查看网卡
#windows查看网卡信息
ipconfig
#linux查看网卡信息
ifconfig
ip link show
#查看网卡文件
cd /etc/sysconfig/network-scripts/
#网卡添加IP地址
ip addr add 192.168.0.100/24 dev eth0
#网卡删除IP地址
ip addr delete192.168.0.100/24 dev eth0
#开启关闭网卡
ifup eth0
ifdown eth0
#网卡namespace创建
ip netns add ns1
ip netns list
ip netns exec ns1 ip a
成对网卡veth pair 分别给每个namespace
#生成成对的网卡
ip link add veth-ns1 type veth peer name veth-ns2
#生成的网卡分派给不同的networknamespace
ip link set veth-ns1 netns ns1
#给命名空间中的网卡添加ip地址
ip netns exec ns1 ip addr add 192.168.8.11/24 dev veth-ns1
#给命名空间中的网卡启动
ip netns exec ns1 ip link set veth-ns1 up
#查看两个网卡是否能ping通
ip netns exec ns1 ping 192.168.8.12
安装工具查看容器内网卡跟宿主机是成对的
yum install bridge-utils
brctl show
网友评论