docker network create command - swarm

178 Views Asked by At

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?

1

There are 1 best solutions below

1
On

docker service create --network is described as Network attachments (ref. docker service create --help), it is to attach a service to an existing docker network as documented here. You can attach a service to multiple docker networks.