Deploying it all

As we did for our simple web server, we will begin by creating another Swarm cluster:

$ docker swarm initSwarm initialized: current node (1y1h7rgpxbsfqryvrxa04rvcp) is now a manager.To add a worker to this swarm, run the following command:    docker swarm join \    --token SWMTKN-1-36flmf9vnika6x5mbxx7vf9kldqaw6bq8lxtkeyaj4r5s461ln-aiqlw49iufv3s6po4z2fytos1 \    192.168.4.128:2377

Then, we need to create our overlay network for the service-discovery hostname resolution to work. You don't need to know much about this other than it creates an isolated network that we will add all the services to:

$ docker network create --driver overlay service_network44cyg4vsitbx81p208vslp0rx

Finally, we will build and launch our containers:

$ cd ../database ...

Get Deployment with Docker now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.