docker swarm & docker networking.

Docker Swarm Architecture | How Nodes and Services Work?

#devops #trainwithshubham #90daysofdevops #docker

Docker Swarm is a powerful tool for managing and orchestrating Docker containers across multiple hosts. One of the key features of Docker Swarm is its networking capabilities, which allow you to create overlay networks that span multiple hosts. In this blog post, we will cover the basics of Docker Swarm networking and provide some useful commands to help you get started.Firstly, it is important to have Docker Swarm installed on your system. Once you have installed it, you can create an overlay network with the following command:

  • docker network create --driver overlay my-network: This command creates an overlay network called my-network.

You can then deploy your services to this network with the following command:

  • docker service create --name my-service --network my-network my-image: This command creates a service called my-service and deploys it to the my-network overlay network.

You can also scale your services up or down with the following command:

  • docker service scale my-service=5: This command scales the my-service service to 5 replicas.

Here are some other useful Docker Swarm networking commands:

  • docker network ls: This command lists all the networks on your Docker Swarm cluster.

  • docker network inspect my-network: This command inspects the my-network overlay network.

  • docker service ls: This command lists all the services on your Docker Swarm cluster.

  • docker service ps my-service: This command lists all the tasks (i.e. containers) for the my-service service.

In conclusion, Docker Swarm is a powerful tool for managing and orchestrating Docker containers across multiple hosts. With Docker Swarm, you can create overlay networks that span multiple hosts and deploy your services to these networks with simple commands. You can also scale your services up or down as required