11 votes

Combine Docker Swarm and Kubernetes

Update: Docker just released support for Kubernetes as scheduler, which changes the situation and makes Kubernetes just an alternative scheduler to Docker Swarm. TL;DR: DON'T DO IT. Engineers always ...
  • 5,677
6 votes
Accepted

Will Docker Swarm work if masters are spread over 3 continents?

There are various timeouts within swarm mode that do not handle high latency well and may start to assume nodes within the cluster are down, lose quorum, or have networking issues. For HA, the ...
  • 2,830
5 votes
Accepted

Docker swarm stop spin up containers at 250

I just figure it out. The problem is not with the service or the swarm, it's with the network. When I use driver: overlay the default subnet is 10.0.0.0/24 which result in 254 address. So I change ...
  • 201
4 votes
Accepted

Options to assign a static ip to a service running in docker swarm

On June 30, 2016 this issue was created on GitHub to request the implementation of static IP on docker-swarm services. Since then multiple replies with thumbs up and down were added. At the time of ...
  • 12.7k
4 votes
Accepted

Docker stack deploy doesn't pull images

So it turned out that some of the workers didn't have the correct credentials to the docker registry. After I applied the correct ones, the command worked normally. That's weird, since I could do it ...
  • 211
4 votes
Accepted

Docker Swarm set which service goes to which machine

In the placement section of the compose file, you can specify constraints. I'd recommend using node labels so you can add more potential nodes (should an existing node fail) without redefining any ...
  • 2,830
3 votes

How to get hostname from node-exporter in Docker Swarm?

You just have to use the hostname on your docker compose file like this: hostname: whatever-{{.Node.Hostname}} Note that you have to prepend something to the hostname to avoid hostnames duplicates.
  • 31
3 votes
Accepted

Docker swarm join linux container Error - remote CA does not match fingerprint

If you configured and joined correctly you should see two hosts: one for Linux and one for Windows. Windows hosts cannot natively run inside the Linux hosts and vice-versa. This means you have to ...
  • 146
3 votes
Accepted

Docker MongoDB image - How to specify credentials other than in the compose file?

Secrets support for mongo is built in. You can see in that image's entrypoint script that if you add _FILE to end of username/password values it will pull from those secret files. As for .js files, ...
3 votes
Accepted

Load balancing kubernetes cluster on budget KVM provider?

It depends on how much time you can invest into configuration and your configuration. I have built my own cluster on AWS using Nomad and Consul where Fabio was used as Application Load Balancing ...
  • 446
3 votes
Accepted

In what all cases would one use an external load balancer over the Ingress routing mesh in a Docker cluster?

You missed a point that there's still a need in balancing traffic before nodes in Docker cluster, and ELB is great for it (managed cluster, healthchecks, you don't pay for number of ELB instances per ...
3 votes

Assign DNS name to Docker Swarm containers with public IPv6

Assuming that "publicly available" is on the public internet it will be difficult. DNS isn't really that reactive to changes and is challenging to run in a secure fashion on the public internet. It ...
  • 366
3 votes
Accepted

Why `docker stack` needs Docker to run in swarm mode? What are the implications when working on a single node?

Why it is mandatory to switch to swarm mode to run docker stack? A stack and service are swarm mode objects by their very definition. The stack is a collection of services, and each service is a ...
  • 2,830
3 votes

Access private DockerHub repo in Docker Swarm

You need the --with-registry-auth flag, e.g.: docker stack deploy -c myapp.yml --with-registry-auth myapp From the docker stack deploy --help output: --with-registry-auth Send registry ...
  • 2,830
2 votes
Accepted

How can secrets be distributed in a docker swarm?

Once the secret reaches a manager node, it gets saved to the internal Raft store, which uses NACL’s Salsa20Poly1305 with a 256-bit key to ensure no data is ever written to disk unencrypted. ...
2 votes
Accepted

Flask, Gunicorn and Docker Swarm

Yes, when using Docker Swarm you'll still want to use Gunicorn in your Docker containers. Gunicorn is necessary to facilitate the communication between the server and your web application. In the ...
  • 136
2 votes
Accepted

Is a decentralized Docker swarm possible?

By Docker Swarm design it is dencentralized, so you can promote any node to a manager. Normally, 3 managers are enough, for landscapes with thousands of nodes 5 are enough. https://docs.docker.com/...
2 votes

Automated Docker swarm reinitialization and token distribution

Have the Swarm Manager place the worker join token in a Key/Value store. We use AWS Parameter Store but I believe Consul would be another option (I don't use it). Each node can then retrieve the ...
  • 738
2 votes

Docker MongoDB image - How to specify credentials other than in the compose file?

Here's a solution I've used in cases like this - I utilize Ansible to manage Docker containers, and Ansible Vault to store secrets for those containers. Ansible Playbook to run MongoDB container ...
  • 601
2 votes

Docker swarm replica stays 0/1 and service stays in status new

Try do pull your image manually first. docker pull ${DOCKER_REGISTRY}imageNameX:${VERSION} And then re-run your compose-file It may be a bug using a private registry, or something simple as you don't ...
2 votes
Accepted

Join a Linux Docker swarm with a local Windows Docker for test purposes

Why do you want to create a new Manager node, risking damaging your raft consensus and cie? I find it way easier to simply expose the docker socket locally, as if you were working inside the node, but ...
  • 131
2 votes

Docker Swarm join-token not working

The swarm protocol is not http, so you will not be able to pass it through a proxy. Swarm nodes need direct communication between each node on port 2377/tcp (or your configured swarm port), 7946/both, ...
  • 2,830
2 votes

How to fix a "heartbeat failure" in Docker Swarm?

This might not be the answer to your specific cross data-center-ip setup. I occasionally run into one or more swarm-nodes being status: Down and Availability: Active. Having the Status.Message: "...
  • 121
2 votes
Accepted

How do I prevent service A from being placed in the same node as service B in Docker Swarm?

At present the answer is "no", swarm mode does not support affinity or anti-affinity between a service and other containers/services running on a node. However, depending on your goal there are other ...
  • 2,830
2 votes

How to automatically update Swarm services when the Docker daemon restarts

You don't need a restart policy with swarm mode. Swarm mode will constantly try to reconcile any differences between the current and target state. I've seen cases where the restart policy enforced by ...
  • 2,830
2 votes
Accepted

How does Docker Swarm balance tasks?

AFAIK, Swarm does zero real-time resource monitoring. It's only as smart as reservations and limits that you set on the Service beforehand. First, it takes into account if the tasks of that Service ...
1 vote

Executing a command in running docker swarm service

I suggest making a cronjob container that does the SQL dump and elastic index using docker exec commands toward the corresponding containers.
1 vote
Accepted

Is it ok to logout after calling docker stack deploy?

It is safe. As soon as docker returns it is safe to logout/leave the shell. The issue was that Docker 18.06.0-ce broke docker stack deploy. Reverting to 18.03.1 (specifically 18.03.1~ce-0~ubuntu) ...
1 vote
Accepted

Docker Swarm loop

Docker containers are isolated applications. When the application that it launches exits, the container also exits. So when your command is ls, that will run and then exit almost immediately, stopping ...
  • 2,830
1 vote

Error while trying to run docker redis image on Alpine Linux 3.7.0

One could also use a docker image from an official docker repository like https://hub.docker.com/r/library/redis/ docker run --name some-redis -d redis:alpine
  • 12.7k

Only top scored, non community-wiki answers of a minimum length are eligible