参考 https://www.cnblogs.com/CloudMan6/p/7471162.html
weave 是 Weaveworks 开发的容器网络解决方案. weave 创建的虚拟网络可以将部署在多个 host 上的容器连接起来.
对于容器来说, weave 就像一个巨大的以太网交换机, 所有容器都被接入这个交换机, 容器可以直接通信, 无需 NAT 和端口映射.
除此之外, weave 的 DNS 模块使容器可以通过 hostname 访问
实验环境
weave 不依赖分布式数据库 (etcd 或者 consul) 存储交换网络信息. 每个主机上只需运行 weave 组件就能建立起跨 host 容器网络.
- # 1, 下载安装 weave
- [email protected]:~# curl -L Git.io/weave -o /usr/local/bin/weave
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
- 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
- 100 595 0 595 0 0 213 0 --:--:-- 0:00:02 --:--:-- 581k
- 100 52227 100 52227 0 0 11236 0 0:00:04 0:00:04 --:--:-- 58616
- [email protected]:~# chmod a+x /usr/local/bin/weave
- # 2, 运行 weave
- [email protected]:~# weave launch
- 2.5.1: Pulling from weaveworks/weave
- a073c86ecf9e: Pull complete
- 950f028f729b: Pull complete
- d1298aa928c2: Pull complete
- 1d157c01c74e: Pull complete
- c458f7a37ca6: Pull complete
- Digest: sha256:a170dd93fa7e678cc37919ffd65601d1015da6c3f10878534ac237381ea0db19
- Status: Downloaded newer image for weaveworks/weave:2.5.1
- latest: Pulling from weaveworks/weavedb
- 9b0681f946a1: Pull complete
- Digest: sha256:c280cf4e7208f4ca0d2514539e0f476dd12db70beacdc368793b7736de023d8d
- Status: Downloaded newer image for weaveworks/weavedb:latest
- Unable to find image 'weaveworks/weaveexec:2.5.1' locally
- 2.5.1: Pulling from weaveworks/weaveexec
- a073c86ecf9e: Already exists
- 950f028f729b: Already exists
- d1298aa928c2: Already exists
- 1d157c01c74e: Already exists
- c458f7a37ca6: Already exists
- 49a09e96fcfc: Pull complete
- 6d57eb599283: Pull complete
- 259765bea433: Pull complete
- c11f30d06b58: Pull complete
- Digest: sha256:ad53aaabf648548ec26cceac3ab49394778322e1623f0d184a2b74ad06338087
- Status: Downloaded newer image for weaveworks/weaveexec:2.5.1
- 7e8598656934a6655d16c34eeb1df238acf76692f7f5f530101ac5c722a78f43
- # 3, 查看 weave 运行状态, 容器和网络
- [email protected]:~# docker ps -a
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- 7e8598656934 weaveworks/weave:2.5.1 "/home/weave/weaver ..." 27 seconds ago Up 26 seconds weave
- 65fab63189a6 weaveworks/weaveexec:2.5.1 "data-only" 27 seconds ago Created weavevolumes-2.5.1
- a4d5d7b88819 weaveworks/weavedb:latest "data-only" 28 seconds ago Created weavedb
- [email protected]:~# docker network ls
- NETWORK ID NAME DRIVER SCOPE
- 59984053007a bridge bridge local
- bb03f7574aa2 host host local
- d60df792c936 mac_net1 macvlan local
- 884e50ddfb92 mac_net10 macvlan local
- c402380a197d mac_net20 macvlan local
- 11e39328a6d1 none null local
- e364db005326 weave weavemesh local
- [email protected]:~# docker network inspect weave
- [
- {
- "Name": "weave",
- "Id": "e364db00532678e57f983e286f31ccc10a9fdb152b7b87dafcf48e7675dff3fc",
- "Created": "2019-04-03T08:35:57.945367052+08:00",
- "Scope": "local",
- "Driver": "weavemesh",
- "EnableIPv6": false,
- "IPAM": {
- "Driver": "weavemesh",
- "Options": null,
- "Config": [
- {
- "Subnet": "10.32.0.0/12"
- }
- ]
- },
- "Internal": false,
- "Attachable": false,
- "Ingress": false,
- "ConfigFrom": {
- "Network": ""},"ConfigOnly": false,"Containers": {},"Options": {"works.weave.multicast":"true"},"Labels": {
- }
- }
- ]
来源: http://www.bubuko.com/infodetail-3009427.html