Lab #3: Create a service

In this lab we will be looking to different option to connect service with user defined Overlay network.

Pre-requisite:

Tested Infrastructure

Platform Number of Instance Reading Time
Play with Docker 2 5 min

Pre-requisite

Create service on overlay network myoverlay0

$ docker service create --name testWeb -p 80:80 --network=myoverlay0 --replicas 3 httpd

Checking Network ID for the service

$ docker service inspect --format= testWeb

Connect an existing service to an overlay network

Createing A new service with name testApp

$ docker service create --name testApp -p 8081:80 --replicas 3 nginx:alpine

Checking the current network for the service

$ docker service inspect --format= testApp

Connecting service to userdefined network myoverlay0

$ docker service update --network-add myoverlay0 testApp

Checking the current network Endpoint for the service

$ docker service inspect --format= testApp

Removing user defined network myoverlay0 for service testApp

$ docker service update --network-rm myoverlay0 testApp

Contributor

Savio Mathew