Docker Swarm join-token not working I am trying to add a new node into my swarm over the internet but it doesn't seem to connect through a proxy.

I am trying to proxy using Caddy. The proxy configuration results in the same as for any other server like proxy_pass in nginx.

Caddy automatically sets up HTTPS for the subdomain and all traffic is set to be redirected from port 80 to 443. My caddy configuration is:

swarm.mydomain.com {
    proxy / http://&lt;docker-swarm-manager-ip&gt;:2377 {
        transparent
    }
}


From the docker swarm manager, I get the join-token which gives me something like:

docker swarm join --token &lt;some-long-hash&gt; &lt;docker-swarm-manager-ip&gt;:2377


On the node I want to connect to the swarm, I have tried the command:

sudo docker swarm join --token &lt;some-long-hash&gt; swarm.mydomain.com


This gives me the error:


  Error response from daemon: rpc error: code = Unavailable desc = grpc: the connection is unavailable


I then tried specifying the SSL port:

sudo docker swarm join --token &lt;some-long-hash&gt; swarm.mydomain.com:443


This gives me the error:


  Error response from daemon: rpc error: code = FailedPrecondition desc = transport: received the unexpected content-type "text/plain; charset=utf-8"


I am new to docker swarm and I can't find any similar setup online. Any help is appreciated.

Note:


I am able to ping the manager from the node successfully.
port 2377 is is open on the manager and the node I want to connect.
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.