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
• 1,000 points

edited Dec 11, 2018 by Shubham 1,255 views

1 answer to this question.

+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,980 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 30, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
1,220 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,220 points
2,200 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,300 points
2,404 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
• 52,350 points
2,382 views
+2 votes
1 answer
+2 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
• 58,020 points
2,719 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,980 points
743 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,980 points
3,793 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP