How to orchestrate a multi-tier web-app over swarm cluster ?

+4 votes
I am having a PHP image and a Mysql image. I want to orchestrate those two images as containers over the swarm cluster so that they can communicate with each other.

Which network should I use among all the network types in Docker networking?

Can anyone help me with this query?

Thanks.
Dec 11, 2018 in DevOps & Agile by Shubham
• 980 points

edited Dec 11, 2018 by Shubham 21 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+4 votes
Best answer

I understand from your query that you need to orchestrate those two containers as services.

Since you want them to orchestrate over swarm cluster, you should use OVERLAY network.

Here is what you should try.

Create an overlay network first by using below commands:

docker network create -d overlay network_name

You can give your network name anything.Now your overlay network is created, you will have to orchestrate your containers as services over cluster using the created overlay network by using below commands:

docker service create --name mywebapp -d --network network_name -p 8001:80 phpimage_name

docker service create --name mysqlapp -d --network network_name -p 3306:3306 mysqlimage_name

Since, after using the above commands, you will be able to see the two services running as containers on your swarm cluster by using the below command i.e.,

docker ps

You can go inside the container and make the changes which are required by using below command i.e,

docker exec -it container_id bash  

Now check the node on which php container is running and run that PHP application on the browser at port 8001. You will be able to access that php application.

I hope that it will resolve your query.

answered Dec 11, 2018 by Damon Salvatore
• 5,250 points

selected Dec 12, 2018 by Omkar

Related Questions In DevOps & Agile

0 votes
1 answer

How to a run deployed app in Docker for Windows?

To deploy an ASP.NET web application to ...READ MORE

answered Aug 29, 2018 in DevOps & Agile by Tyrion anex
• 8,280 points
77 views
+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,100 points
50 views
0 votes
1 answer

How to set up a VM with KVM/qemu without VitualBox using Vagrant

Start the vagrant box using: vagrant up --provider=kvm But ...READ MORE

answered Apr 11, 2018 in DevOps & Agile by ajs3033
• 7,000 points
280 views
0 votes
1 answer

How to get remote access to a private docker-registry?

New client version refuses to work with ...READ MORE

answered Jul 31, 2018 in DevOps & Agile by Kalgi
• 35,750 points
47 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,120 points
56 views
+1 vote
1 answer

How to add a node as a manager in swarm cluster?

Here is what you can try and ...READ MORE

answered Dec 10, 2018 in DevOps & Agile by Damon Salvatore
• 5,250 points
43 views
0 votes
1 answer

How to edit file after I shell to a docker container?

Since docker images are trimmed to bare minimum ...READ MORE

answered Sep 11, 2018 in DevOps & Agile by Damon Salvatore
• 5,250 points
39 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.