I’m newbie to Docker, but i’d like to know: is it possible to connect one container from another container on Linux machine (any) with UNIX sockets? For example i have one container for application core and second containers which covers database things. Second example is two containers with application code, and first container can trigger some events in second.
Performance really matters for me in both cases. If it’s impossible to do this way, is there is any solution for these problems?
Thanks!
Yes. You can mount a socket into a container using a volume mount. And multiple containers can mount the same volume, whether that's a named volume or a host mount, to share the socket between the containers. You see this frequently with containers that mount the docker socket today, e.g.
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock busybox
will run a container with the docker socket mounted.
Notes on the docker.sock itself:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With