<p>Docker Swarm is a layer over Docker and it manages the creation of containers on nodes given docker service definitions.</p>
<p>As I understand it, Jenkins does not know docker swarm, and simply asks the target node to create containers. Docker swarm, and its orchestration is consequently not involved - everything gets created and scheduled on the target node only.</p>

CC BY-SA 4.0
2023-02-16T11:41:00.727Z
2023-02-16T11:41:00.727Z
Chris Becke
<p>I have a cluster which is being used as a docker swarm - 1 manager, and 4 workers. The manager node is a pure manager node, set via</p>
<pre><code>docker node update --availability drain &lt;manager-id&gt;
</code></pre>
<p>The manager has the <code>/usr/lib/systemd/system/docker.service</code> set to start with</p>
<pre><code>ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock
</code></pre>
<p>Now I am trying to use this cluster/swarm as a Jenkins cloud provider, so that all jobs run in docker containers in this swarm. In Jenkins, under <code>Configure Clouds</code>, I have create a cloud provider of type &quot;docker&quot;, and provided the manager IP address as the docker host uri, eg. <code>tcp://a.b.c.d:2375</code>. There is no error, but when I start a job, it creates a container on the manager itself.</p>
<p>How can I make it so that each container is deployed on a non-manager container?</p>

<jenkins><docker-swarm>
Using docker-swarm with Jenkins
Ufder
# Using docker-swarm with Jenkins

(Asked by: username_0 on 2023-02-15)

I have a cluster which is being used as a docker swarm - 1 manager, and 4 workers. The manager node is a pure manager node, set via
docker node update --availability drain 

The manager has the /usr/lib/systemd/system/docker.service set to start with
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock

Now I am trying to use this cluster/swarm as a Jenkins cloud provider, so that all jobs run in docker containers in this swarm. In Jenkins, under Configure Clouds, I have create a cloud provider of type "docker", and provided the manager IP address as the docker host uri, eg. tcp://a.b.c.d:2375. There is no error, but when I start a job, it creates a container on the manager itself.
How can I make it so that each container is deployed on a non-manager container?

**Tags:** jenkins, docker-swarm


---

## 1 answers

### Answer by username_1 on 2023-02-16. Score: 0

Docker Swarm is a layer over Docker and it manages the creation of containers on nodes given docker service definitions.

As I understand it, Jenkins does not know docker swarm, and simply asks the target node to create containers. Docker swarm, and its orchestration is consequently not involved - everything gets created and scheduled on the target node only.


---

