Being new to Docker (but not Azure) I would like to understand how tiers of an application are usually separated when deploying Docker containers to Azure (I am thinking of using Azure Container Services).

For example, if not using Docker, I would place a VM in a web tier/subnet, and a VM in the database tier/subnet and set the NSG rules accordingly.

How is this achieved with Docker, would I deploy Docker into multiple subnets, or would I just have one subnet say, to which I deploy all containers and then somehow set the networking rules between those containers?



Docker Swarm-mode has the concept of network-definitions in your docker-compose file which provides a form of fine grained network segmentation. If this is not sufficient for you then you can run separate instance of Docker in the different network segments and use non-swarm mechanisms for the services to find each other.


How is this achieved with Docker, would I deploy Docker into multiple subnets, or would I just have one subnet say.

In Azure container service, if we choose kubernetes, Azure will create multiple subnets for masters and nodes.
Container use cluster IP(different with azure VM IP) address communicate with other containers, if we want this container can be access from the internet, we can expose this container to the Internet with Azure public Load Balancer, then use this public IP address to access it from the Internet. Azure VM in the this Vnet can't communicate with containers.

So, if we chose kubernetes, we can create multiple containers work as database server, and create another container work as web server, connect web container to database containers, then expose this web container to the Internet, in this way, we can access this web via Azure Load Balancer Public IP address. Web container and database containers in one pod, different pods with different pod CIDR.

Kubernetes is a open-source, production-grade container orchestrator tool, the following image show how kubernetes works on Azure:

enter image description here

If you want to use docker to deploy multiple containers, we should design network, different subnets, different bridge networks and so on. The most convenient way is to use container orchestrator tool, like kubernetes, swarm or DC/OS.

  • Thanks for your answer. If I wanted to deploy a Docker image that would scale (a web app say) but then also some that shouldn't scale (a database say), would I deploy both to the same Azure Container Services instance/cluster or should I use separate clusters for each?
    – P2l
    Jul 7 '17 at 15:06
  • @P2l Yes, we should deploy both to same azure container service, about scale out or in, all the containers will be created in the same pods, no need to create them in separate clusters.
    – Jason Ye
    Jul 7 '17 at 15:31
  • @P2l If you need more help, please let me know. Also if it helps, please don't forget to accept it as an answer, thanks.
    – Jason Ye
    Jul 12 '17 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.