My problem is that I can’t deploy services to the worker node in the macOS system, when I add macOS to the docker swarm. Specifically, I first use an Ubuntu system as the master node and macOS as a worker node to consist a swarm; Second, I use “docker stack deploy” to deploy my services to these nodes; Finally, I found that the worker node always disconnects, as in
Consequently, all services are deployed to the master node (i.e., manager), such as
ChatGPT says you can’t have macOS as worker node
Worker nodes, where the containers are actually run, must be Linux machines due to the Linux kernel’s containerization features that Docker relies upon.
But I admit that I am not sure if this is true. I thought macOS Docker Desktop runs a full Linux VM, so I would expect it to work as long as the images are compatible with the CPU.
You probably need to open ports
Since the docker engine is running in the vitual machine of Docker Desktop, and swarm ports are not all forwarded from the host (if any, I don’t remember), you need to do it manually. I also don’t remember how I did it, but I think I tried it once. I probably just ran a container which opened the necessary ports and used alpine/socat to forward the ports to the IP address of Docker Desktop’s virtual machine.
According to the quote, it just said that Docker needs a Linux machine, whihc is true, since there is no native MacOS container, but if you ask it differently, it will probably say yes