Below is the command used to create overlay
network driver for swarm cluster instead of using bridge
network driver
$ docker network create -d overlay xyz
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
9c431bc9fec7 bridge bridge local
88a4c6a29fa4 docker_gwbridge bridge local
10a4bc649237 host host local
o79qllmq86xw ingress overlay swarm
417aca5efd6b none null local
nsteeoxfu9b1 xyz overlay swarm
$
$ docker service create --name service_name --network xyz -p 80:80 --repicas 12 <image>
What exactly is the purpose of service command using option --network xyz
? is this the network namespace driver?
docker service create --network
is described asNetwork attachments
(ref.docker service create --help
), it is to attach a service to an existingdocker
network
as documented here. You can attach a service to multipledocker
networks
.