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://<docker-swarm-manager-ip>:2377 {
transparent
}
}
From the docker swarm manager, I get the join-token which gives me something like:
docker swarm join --token <some-long-hash> <docker-swarm-manager-ip>:2377
On the node I want to connect to the swarm, I have tried the command:
sudo docker swarm join --token <some-long-hash> 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 <some-long-hash> 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.