kata macvlan
作者:互联网
1. $ docker network create -d macvlan macvlan1 2. $docker run -d --runtime=kata-runtime --network=macvlan --name=containerA debian sh -c "tail -f /dev/null" 3. $ip_address=$(docker inspect --format "{{.NetworkSettings.Networks.macvlan1.IPAddress}}" containerA) 4. $ docker run --runtime=kata-runtime --network=macvlan --name=containerB debian sh -c "ping -c 5 ${ip_address}" PING 172.20.0.2 (172.20.0.2) 56(84) bytes of data. From 172.20.0.3 icmp_seq=1 Destination Host Unreachable From 172.20.0.3 icmp_seq=2 Destination Host Unreachable From 172.20.0.3 icmp_seq=3 Destination Host Unreachable From 172.20.0.3 icmp_seq=4 Destination Host Unreachable
root@cloud:~/qemu-system# docker network create -d macvlan macvlan1 493626720dc17e342cc1f682d4df7089367e6798b7e8d4543d4b78673a411211 root@cloud:~/qemu-system# docker run -d --runtime=kata-runtime --network=macvlan1 --name=containerA busybox sh -c "tail -f /dev/null" 53bcd4892ff0321749d83d79393a4d3431fbef19272a989d9eecf6cf8fea7e5c root@cloud:~/qemu-system# ip_address=$(docker inspect --format "{{.NetworkSettings.Networks.macvlan1.IPAddress}}" containerA) root@cloud:~/qemu-system# echo $ip_address 172.18.0.2
root@cloud:~/qemu-system# ip a | grep 172.18. root@cloud:~/qemu-system#
root@cloud:~/qemu-system# docker exec -it containerA bash OCI runtime exec failed: rpc error: code = Internal desc = Could not run process: container_linux.go:349: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown root@cloud:~/qemu-system# docker exec -it containerA sh / # ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel qlen 1000 link/ether 02:42:ac:12:00:02 brd ff:ff:ff:ff:ff:ff inet 172.18.0.2/16 brd 172.18.255.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::42:acff:fe12:2/64 scope link valid_lft forever preferred_lft forever / # ping 172.18.0.2 PING 172.18.0.2 (172.18.0.2): 56 data bytes 64 bytes from 172.18.0.2: seq=0 ttl=64 time=0.918 ms ^C --- 172.18.0.2 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 0.918/0.918/0.918 ms / # ping 172.18.0.1 PING 172.18.0.1 (172.18.0.1): 56 data bytes ^C --- 172.18.0.1 ping statistics --- 1 packets transmitted, 0 packets received, 100% packet loss / # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.18.0.1 0.0.0.0 UG 0 0 0 eth0 172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 / #
标签:00,lft,--,0.2,macvlan,172.18,kata,docker 来源: https://www.cnblogs.com/dream397/p/13968642.html