Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
9

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 try to create these dog-pigs. Every unnecessary technology you bring will bring another whole set of faults. If you can pick one, then pick one and be happy ...


5

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 the mask in the subnet, to 22, which result in 1022 address, I added: ipam: config: -subnet: 10.0.0.0/22 And now the network section in the docker-compose ...


4

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 definition of a target state. Swarm mode takes those target states and manages containers to achieve that target state. And most important, what are the ...


4

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 standard advice is to have multi-AZ but not multi-region for a single cluster. For use cases that need multi-region, you would deploy multiple swarm clusters, one per ...


3

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 have different kernels for Linux hosts and Windows hosts in the same swarm. This way they can communicate across the same Docker network. Refer to Docker Engine ...


3

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 layer (AWS ALB was lacking for my purposes). Alternatively if you use k8s and do not need additional ALB you can use DNS RR (multiple A or AAAA records for your ...


3

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 VPC, you can spawn spare nodes and register them in ELB automagically with Cloudwatch), great discussion on ServerFault. Basically, external balancer will split ...


2

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 also depends on what protocol you are running, because of an oddity around SRV records where pre-existing protocols were excluded from supporting it in the RFC. ...


2

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. Writing to the internal store gives secrets the same high availability guarantees that the the rest of the swarm management data gets. https://blog.docker.com/...


2

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/engine/swarm/admin_guide/


2

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 token while it is bootstrapping.


2

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 Your playbook.yml may look something like this: - name: run mongodb docker container docker_container: name: mongo-container image: mongo ports: ...


2

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.


2

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 options. One option is to reserve resources like CPU and memory for your container. This will ensure two resource intensive applications do not schedule ...


2

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, and 4789/udp. If you configure an overlay network with the secure option for IPSec, then you'll also need protocol 50 open between the nodes.


1

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


1

It seems like the AutoScaling Group from AWS are not that synchronized with the Docker Swarm configuration and the default timeouts in the AutoScaling are not accepted in the Docker Swarm managers. Actually the Health Check is not configured good by default in the EE CloudFormation template, even if the managers are running and stable the Health Check fails ...


1

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


1

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) made it work.


1

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 the container. Swarm mode has the goal to maintain a target state for your containers. By default, it will keep a single replica (instance of a container) of ...


1

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, if you're storing decrypted passwords in those files, you'd need to make a custom entrypoint script or something that will take envvars you're passing in for ...


1

I think Windows Server 2016 needs at least 17.09 Docker EE to support overlay networking and VIP's. I recommend updating it. I was wrong, the latest version is indeed 17.06.2-ee-6 and should support overlay and VIP. Second, ping isn't a good test, as it may not be available on the VIP or container IP depending on the setup (Docker has changed over time if ...


1

Simple answer with infrastructure as code, you don't rejoin nodes, you trash old nodes and bring fresh nodes to join the cluster.


1

Extending Peter Muryshkin’s answer with an significant restriction. Distributing secrets has to be adapted to a file-based approach. Note: Docker secrets do not set environment variables directly. This was a conscious decision, because environment variables can unintentionally be leaked between containers (for instance, if you use --link). Some ...


1

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 case of a Dockerized Flask application this is still the case as Gunicorn handles the communication between the Flask application and the Docker container. Adding ...


1

I would check that all nodes are active and ready with command docker node ls With docker swarm leave and docker swarm join \ --token <SWMTKN token> \ <manager private IP> you may rejoin malfunctioning node.


1

If you don't want the containers to restart, you can set the condition: to none. See https://docs.docker.com/compose/compose-file/#restart_policy On the swarm manager, you could use docker stack ps to check the status of the containers on a regular basis and shut down the stack if the database containers aren't running (using cron or whatever). For example: ...


1

Could you please try the commands above between all hosts ? INSIDE HOST A: nc -zv HOST_B_IP_ADDRESS 2377,4789,7946 nc -zv HOST_C_IP_ADDRESS 2377,4789,7946 INSIDE HOST B: nc -zv HOST_A_IP_ADDRESS 2377,4789,7946 nc -zv HOST_C_IP_ADDRESS 2377,4789,7946 INSIDE HOST C: nc -zv HOST_A_IP_ADDRESS 2377,4789,7946 nc -zv HOST_B_IP_ADDRESS 2377,4789,7946 As ...


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