{"id":26862109,"url":"https://github.com/dhanikaa/docker-swarm","last_synced_at":"2026-04-28T23:31:49.499Z","repository":{"id":285145999,"uuid":"957201179","full_name":"dhanikaa/Docker-swarm","owner":"dhanikaa","description":"A demonstration on how to set up and manage services in a Docker Swarm cluster. It includes examples of Dockerfiles, a custom Nginx configuration, and a docker-compose.yml file for deploying and scaling services in Swarm, with a focus on high availability and fault tolerance. Perfect for learning Docker Swarm orchestration.","archived":false,"fork":false,"pushed_at":"2025-03-29T19:55:02.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T20:29:34.537Z","etag":null,"topics":["docker","docker-compose","docker-swarm"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dhanikaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-29T19:43:51.000Z","updated_at":"2025-03-29T20:07:45.000Z","dependencies_parsed_at":"2025-03-29T20:40:42.994Z","dependency_job_id":null,"html_url":"https://github.com/dhanikaa/Docker-swarm","commit_stats":null,"previous_names":["dhanikaa/docker-swarm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhanikaa%2FDocker-swarm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhanikaa%2FDocker-swarm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhanikaa%2FDocker-swarm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhanikaa%2FDocker-swarm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhanikaa","download_url":"https://codeload.github.com/dhanikaa/Docker-swarm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246404497,"owners_count":20771620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","docker-swarm"],"created_at":"2025-03-31T02:23:11.075Z","updated_at":"2026-04-28T23:31:49.448Z","avatar_url":"https://github.com/dhanikaa.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Docker Swarm: Orchestration for Docker\n\n## Overview\nDocker Swarm is Docker's native clustering and orchestration solution. It turns a pool of Docker hosts into a single, virtual host. This makes it easier to manage multi-container applications and scale them horizontally across a cluster of machines.\n\nThis repository demonstrates how to set up and use Docker Swarm, deploy services, and scale them efficiently.\n\n## What is Docker Swarm?\nDocker Swarm is Docker's native clustering and orchestration tool. It allows you to manage a group of Docker nodes as a single virtual host. In a Swarm setup, containers are distributed across nodes based on the available resources and scaling requirements. Swarm provides high availability and load balancing for services running in containers.\n\n### Key Features:\n- **Clustering:** Organize multiple Docker hosts into a single Swarm.\n- **Service Discovery:** Swarm provides internal DNS for service discovery.\n- **Load Balancing:** Swarm load-balances traffic between services running in containers.\n- **Scaling:** Easily scale services up or down.\n- **High Availability:** If a container fails, Swarm will restart it on another node.\n\n## Setting Up Docker Swarm Cluster\n\nTo set up a Docker Swarm cluster, follow these steps:\n\n1. **Initialize the Swarm on the Manager Node:**\n   On the manager node, run the following command:\n   ```bash\n   docker swarm init --advertise-addr \u003cMANAGER-IP\u003e\n   ```\n\n2. **Join Worker Nodes to the Swarm Cluster:**\n   Once the Swarm is initialized, you’ll be provided with a command to join worker nodes to the cluster. Run the command on the worker node:\n   ```bash\n   docker swarm join --token \u003cWORKER-TOKEN\u003e \u003cMANAGER-IP\u003e:2377\n   ```\n\n3. **Verify the Cluster:**\n   To ensure that your nodes are part of the cluster, use the following command on the manager node:\n   ```bash\n   docker node ls\n   ```\n\n## Deploying Services in Docker Swarm\n\nDocker Swarm allows you to deploy and manage services across multiple containers and nodes. A service in Swarm is simply a container or a group of containers running a specific application.\n\nTo deploy a service in Docker Swarm:\n\n1. **Create and Deploy the Service:**\n   ```bash\n   docker service create --name my-web-service --replicas 3 -p 80:80 nginx\n   ```\n   This will create a service named `my-web-service`, running three replicas of an NGINX container, and exposing port 80.\n\n2. **Verify the Service:**\n   ```bash\n   docker service ls\n   ```\n\n3. **Inspect the Service:**\n   To get detailed information about the service:\n   ```bash\n   docker service ps my-web-service\n   ```\n\n## Scaling Services in Docker Swarm\n\nOne of the key benefits of Docker Swarm is the ability to easily scale services up or down.\n\n1. **Scale a Service:**\n   To increase the number of replicas for a service, use the following command:\n   ```bash\n   docker service scale my-web-service=5\n   ```\n   This will scale the `my-web-service` to 5 replicas.\n\n2. **Verify the Scale:**\n   ```bash\n   docker service ps my-web-service\n   ```\n\n3. **Remove a Service:**\n   If you no longer need a service, remove it with the following command:\n   ```bash\n   docker service rm my-web-service\n   ```\n\n## Conclusion\nDocker Swarm provides a robust and easy-to-use solution for orchestrating containers across multiple hosts. It simplifies the process of scaling, load balancing, and managing services in production environments. With its built-in features, Docker Swarm allows developers to deploy, scale, and manage their applications efficiently with minimal overhead.\n\n## Additional Resources\n- [Docker Swarm Documentation](https://docs.docker.com/engine/swarm/)\n- [Docker Compose with Swarm](https://docs.docker.com/compose/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhanikaa%2Fdocker-swarm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhanikaa%2Fdocker-swarm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhanikaa%2Fdocker-swarm/lists"}