Check the network drivers on the manager and nodes of the swarm cluster
sudo docker network ls
NETWORK ID NAME DRIVER SCOPE
3d20cac2088d bridge bridge local
550b260adc35 host host local
00pmevu2bkif ingress overlay swarm
2440bbbbab37 none null local
sudo docker network create -d overlay nginx-net1
rcxgd4bowz1pts5nl9r42iahs
sudo docker service create --name nginx-service1 --publish 81:80 --replicas=5 --network nginx-net1 nginx
mfg7jgmbcb9abe0y562aw7fzl
overall progress: 5 out of 5 tasks
1/5: running [==================================================>]
2/5: running [==================================================>]
3/5: running [==================================================>]
4/5: running [==================================================>]
5/5: running [==================================================>]
verify: Service converged
sudo docker network ls
NETWORK ID NAME DRIVER SCOPE
rcxgd4bowz1p nginx-net1 overlay swarm
sudo docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
mfg7jgmbcb9a nginx-service1 replicated 5/5 nginx:latest *:81->80/tcp
sudo docker network inspect nginx-net1
[
{
"Name": "nginx-net1",
"Id": "rcxgd4bowz1pts5nl9r42iahs",
"Created": "2022-06-09T00:35:18.043214493Z",
"Scope": "swarm",
"Driver": "overlay",
<...>
"lb-nginx-net1": {
"Name": "nginx-net1-endpoint",
"EndpointID": "577d8d04ab97d94340ef9858ff14fea06d90200334befb3c31a8442badd0e675",
"MacAddress": "02:42:0a:00:04:0a",
"IPv4Address": "10.0.4.10/24",
"IPv6Address": ""
<...>
sudo docker service inspect nginx-service1
[
{
"ID": "mfg7jgmbcb9abe0y562aw7fzl",
"Version": {
"Index": 96059
},
"CreatedAt": "2022-06-09T00:35:17.866106427Z",
"UpdatedAt": "2022-06-09T00:35:17.87579055Z",
"Spec": {
"Name": "nginx-service1",
<...>
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 80,
"PublishedPort": 81,
"PublishMode": "ingress"
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 80,
"PublishedPort": 81,
"PublishMode": "ingress"
}
<...>
#check nginx status
curl 172.31.15.10:81
curl 172.31.0.113:81
curl 172.31.8.58:81
sudo docker service rm nginx-service1
nginx-service1
sudo docker network rm nginx-net1
nginx-net1
No comments:
Post a Comment