45.Setup local network

overlay network

Docker network create command syntax

docker network create --help

view current networks

docker network ls

Create a new overlay network, with all default options

docker network create -d overlay defaults-over

Create a new overlay network with specific IP settings

docker network create -d overlay \
--subnet= \
--ip-range= \
--gateway= \

view current networks again

docker network ls

Initial validation

docker network inspect specifics-over --format '{{json .IPAM.Config}}' | jq


Create service tester1

docker service create --detach --replicas 3 --name tester1 \
--network specifics-over alpine tail -f /dev/null

Create service tester2

docker service create --detach --replicas 3 --name tester2 \
--network specifics-over alpine tail -f /dev/null

get the container names

docker container ls

From a container in the tester1 service ping the tester2 service by name

docker container exec -it tester1.3.<GET THE NAME> ping -c 3 tester2

© 2019-2023 @CloudNativeFolks | Documentation Distributed under Apache 2.0 License.

© 2023 Happy to help you with your Cloud Native Journey.