Sharing unix socket via docker volume - permission denied

Solution 1:

Its now 2015 and I assume the kernel patch the Michael mentions has now made it's way into the stable kernel. I have a working example of 2 docker containers one with php-fpm and the other with nginx talking to each other via a unix socket.

See: https://github.com/brad-jones/conductor/tree/master/example-project

The key to it working though was to open up the permissions on the socket.

Eg: listen.mode = 0777 in /etc/php-fpm.d/www.conf

It didn't seem to matter what listen.owner & listen.group were set to. The socket needed to be completely unrestricted, I guess because a user in one container, even if it has the same name in another container is still considered a different user.

Solution 2:

Different containers cannot talk to each other via UNIX domain sockets when they are in different network namespaces. There is an unofficial kernel patch that allows this, but you're on your own if you use it.