• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Episode 18: Docker Swarm – Introduction to Orchestration

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,480
Баллы
155


In previous episodes, we explored Docker Compose for managing multi-container applications. Now, it’s time to move into container orchestration — managing multiple containers across different machines. One of the first orchestration tools introduced by Docker itself is Docker Swarm.

🌐 What is Docker Swarm?

  • Docker Swarm is Docker’s native clustering and orchestration tool.
  • It allows you to create a cluster of Docker nodes and deploy services across them.
  • Provides high availability, scalability, and load balancing.

Think of it as a way to run containers not just on one machine but across many machines working together.

🛠 Key Concepts

  1. Node → A machine participating in the swarm (can be physical or virtual).
  • Manager Node: Handles cluster management, scheduling, and orchestration.
  • Worker Node: Executes the tasks given by the manager.

  1. Service → Defines how containers (called tasks) should run in the swarm.


  2. Task → A running container assigned to a node.


  3. Overlay Network → Enables communication between containers running on different machines.
⚡ Setting Up Docker Swarm

  1. Initialize Swarm Mode on the first machine (manager):

docker swarm init --advertise-addr <MANAGER-IP>



  1. Join Worker Nodes (command is shown after swarm init):

docker swarm join --token <WORKER-TOKEN> <MANAGER-IP>:2377



  1. Verify Nodes in the Swarm:

docker node ls



🚀 Deploying a Service in Swarm


Example: Running an nginx service with 3 replicas


docker service create --name my-nginx --replicas 3 -p 8080:80 nginx




Check running services:


docker service ls
docker service ps my-nginx



🔁 Scaling a Service


docker service scale my-nginx=5




This will automatically balance containers across the nodes.

🛡 Benefits of Docker Swarm

  • Easy setup and integration with Docker CLI.
  • Provides load balancing out of the box.
  • Ensures high availability — if a container fails, Swarm replaces it.
  • Secure by default (TLS encrypted communication).
🎯 When to Use Docker Swarm?

  • Small to medium production clusters.
  • When you need simpler orchestration than Kubernetes.
  • For teams already invested in Docker and looking for an easy scaling solution.

✅ In the next episode, we’ll dive into Docker Networking Deep Dive (Bridge, Host, Overlay, Macvlan) to understand how containers communicate in different environments.


⚡ Question for you: Do you want me to go deeper into Docker Swarm (advanced service deployments, secrets, configs) before we move to networking, or should we continue to networking next?



Источник:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу