Do unix sockets need to be on the same machine?

If I have multiple applications running in different containers, in the cloud, will UNIX sockets still be an option of communicating ? Is it possible, and if so, is it efficient ?

Protocol buffers?

Do you mean TCP/IP Socket? Sockets are not exclusive to Unix. I believe at the heart of every high-level protocols like HTTP, SMTP, etc are sockets. So the answer to your question is yes. You would have to build your own proprietary protocol. But why reinvent the wheel?

A unix domain socket? If the machines are on the same physical host, you can use bindmounts to share them between containers.

Though you really should avoid doing that and use regular network based communication protocolls that work without this additional setup. The problem with using a domain socket through a bind mount is, that most orchestrators need to have the mounts declared at container starttime, while a domain socket can only be created by the application (or with even more additional effort that most orchestrators do not support out of the box).

The easyiest solution is indeed to use regular networking, even within the same host. On top of that you can then use REST, AMQP, Kafka, gRPC, GraphQL, 0MQ, or whatever you like.

1 Like

What type of sockets you talking about? TCP/IP?