Join our Discord Server
Docker Networking

Lab 3: Create a service

Estimated reading: 1 minute 90 views

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 an account with DockerHub
  • Open PWD Platform on your browser
  • Click on Add New Instance on the left side of the screen to bring up Alpine OS instance on the right side
  • Swarm cluster

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
Share this Doc

Lab 3: Create a service

Or copy link

CONTENTS
Join our Discord Server