ID NAME REPLICAS IMAGE
bdkwsgchcydz time-php 6/6 registry.cntv.net/heqin/tvtime-php:v0.84xidan
(5)删除服务
$docker service rm time-php
time-php
7:网络
(1)查看容器网络
$docker network ls
NETWORK ID NAME DRIVER SCOPE
a17f16650bf9 bridge bridge local #容器使用独立网络Namespace,连接docker0虚拟网卡(默认模式)
f1c102babcf8 host host local #容器与主机共享网络Namespace,拥有主机相同网卡
b6a2efce65ef none null local #容器没有任何网卡,适合不需要与外部通信的容器
asa2hv41mtci ingress overlay swarm #swarm集群的的overlay网络,容器可以跨主机网络通信
注:上面三个网络是docker安装后默认带的三个网络,第四个overlay网络是启动swarm之后默认创建的overlay网络。
(2)查看overlay网络信息
$docker network inspect ingress
[
{
"Name": "ingress",
"Id": "asa2hv41mtci2qzjkaonusnc8",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
},
"Internal": false,
"Containers": null,
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "258"
},
"Labels": null
}
]
(3)创建自定义的overlay网络
$docker network create --driver=overlay --subnet=10.88.0.0/24 --gateway=10.88.0.1 net3
c654pb76q9jnni5bpdvd34rg4
$docker network ls
NETWORK ID NAME DRIVER SCOPE
c654pb76q9jn net3 overlay swarm
$docker network inspect net3
[
{
"Name": "net3",
"Id": "c654pb76q9jnni5bpdvd34rg4",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.88.0.0/24",
"Gateway": "10.88.0.1"
}
]
},
"Internal": false,
"Containers": null,
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "258"
},
"Labels": null
}