Skip to content

Dockerfiles for simple and basic Docker Swarm 1.12 new functionnalities (load-balancing, DNS based discovery)

Notifications You must be signed in to change notification settings

eesprit/demo-swarm1_12

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Demonstrating Docker Swarm 1.12 new features

apache-php: base apache (debian jessie based) + mod php5 image

frontend : a simple PHP script displaying the container id and calling a backend

backend : a simple PHP script echoing the container id

RUN

You need to use docker swarm (included in docker engine 1.12) cluster.

Then :

$ docker network create -d overlay demo_net
$ docker service create --name frontend --constraint "affinity:container!=frontend.*" --replicas 3 -p 8080:80 --network demo_net eesprit/frontend
$ docker service create --name backend --constraint "affinity:container!=backend.*" --replicas 3 --network demo_net eesprit/backend

Access the service by pointing your browser to the port 8080 of one of your swarm node (you can change the IP to test it on differents nodes).

The green Id is the id of the frontend container, this illustrates the load-balancing feature from the nodes to the containers.

The red Id is the id of the backend container, this illustrates the DNS based service discovery inside the cluster.

To illustrate the rolling update feature :

Then :

$ docker service update --env COLOR=purple --update-delay 30s --update-parallelism 1 frontend 
$ docker service update --env COLOR=orange --update-delay 30s --update-parallelism 1 backend 

Then go back to your browser, and see the updating engine in action !

About

Dockerfiles for simple and basic Docker Swarm 1.12 new functionnalities (load-balancing, DNS based discovery)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages