Hi Experts …
I am trying to follow a simple overlay network tutorial on my Development environment with TWO MacOS hosts and still could not reach a working Condition
I am following this tutorial : Networking with overlay networks | Docker Docs
My Environment
Mac1 : Catalina with en0 at 192.168.0.189 and Docker Desktop for Mac 4.1.1 , Engine : 20.10.8
Mac2 : Monterey with en0 at 192.168.0.150 and Docker Desktop for Mac 4.3.2 , Engine : 20.10.11
My Goal would be have a POSTGRES SERVER container running on Mac1 accessible from a
POSTGRES Client container running on Mac 2
I have setup the ports accessible by temporarily turn MacOS Firewall off
I can execute the Step 1 on Mac1 ( I would like this host as a MANAGER )
MAC1> $ docker swarm init
BUT when I try the step 2 on Mac2 to add a WORKER Node wit
Updating that after get docker daemon network subnet to default 19.2.168.65.0/24 I got a different error during join
desc = “transport: Error while dialing dial tcp 192.168.65.3:2377: connect: connection refused”
But this is crazy because MacOS firewall is TURNED OFF
Are you trying to join the swarm cluster using the IP address of the virtual machine on the manager Mac? Because that won’t work. You have to use an IP address which is available from other machines. It is not clear to me which IP address belongs to which of your networks but based on the interface name (en0) I guess 192.168.0.189 is an IP on your LAN network and yet you got “no route to host” when you used thatIP address. Then you wrote you updated the docker daemon network to the default and the IP address was 192.168.65.3 which is really in the default IP range the virtual machine has.
I think that setting is just to avoid using the same LAN IP range as your local network. Use your host IP address to join the cluster without changing the Docker subnet unless your have an other existing network (virtual or physical) with a colliding IP range.
Then I run exactly this command on MAC2 ( 192.168.0.150)
MAC2> $ docker swarm join --token SWMTKN-1-5hr6p8nzxvt8xoe32sh2s40qyzdajltb6lsje31pdsflqnf20y-4h9mlhbof6k2s9kvg8gyhwww9 192.168.0.189:2377
and get this →
Error response from daemon: dial unix docker.raw.sock: connect: connection refused
The latter will never work. The former message indicates your docker desktop is not running on the machine which you want to join to the cluster.
One thing I don’t understand is the join command.
Is this really what the docker swarm init shows after running? Or you changed it because this was what I was asked for?
In the meantime I tried to join one docker desktop machine to another but it refuses to join because it “thinks” thee node is already part of the swarm cluster. I don’t have two Macs so one of my machines is a MacBook, the other is a Windows 10 machine.
and I have this
sudo pfctl -vnf /etc/pf.conf 15:57:59
Password:
pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.
scrub-anchor “/" all fragment reassemble
nat-anchor "/” all
rdr-anchor “/" all
anchor "/” all
pass in proto tcp from any to any port = 2377 flags S/SA keep state
pass in proto tcp from any to any port = 7496 flags S/SA keep state
pass in proto udp from any to any port = 7496 keep state
pass in proto udp from any to any port = 4789 keep state
dummynet-anchor “/*” all
Loading anchor com.apple from /etc/pf.anchors/com.apple
anchor “/" all
anchor "/” all
I could join a Linux machine and my othr Docker desktop on Windows 10.
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
k3rqygomduzvyo8utdvgeko52 docker-desktop Ready Active 20.10.11
olxulfdw70r4kzqhfhcz6tteu * docker-desktop Ready Active Leader 20.10.11
xbbmnhfgbi2k2d2pce1syhl0x ta-lteg Down Active 20.10.12
update: I relized my Windows host is “Down”. but I haven’t configured the Windows firewall so maybe it is not inpossible to solve. We just have to make sure the proper port fowarding are working
update2: No, the two desktops are ready and my linux is down probably because it went to sleep in the meantime
Hey … i admit that I do not know what socat do … but I will read about …
The only reason I am trying all this is because I understand that this way I would reach my final goal that is :
MAC1 run a Container with Postgres database
MAC2 run a Container with a Node.js application that need connect to the database running on MAC1 container …
I will need to check how to add this forward TCP trafic to my use case …
Thanks a lot per your Help
You can just run the container on a MacOS swarm manager and use --restart=always which I forgot about. Then it should work. socat will do the port forwarding, you just need to use the port 2378 to join the cluster instead of port 2377