[ccache] Shared ccache directory between docker containers

Anders Björklund anders at itension.se
Mon Feb 8 21:24:01 UTC 2016

Ragnar Rova wrote:
> Thanks, i'll try upgrading although I made sure hostname is unique now.

>> Is it safe to share the ccache directory between docker containers wrt
>> to locking?

It would also be interesting to test sharing a cache between containers
on different hosts, by using the "memcached" feature over the network:


One method of doing so is mounting a moxi socket inside the container,
to avoid it having to "know" about the rest of the memcached network...

docker run -v /tmp/moxi.sock:/tmp/moxi.sock [...]

Then you can access the memcached servers over this unix socket,
while sharing the latest cache data in host memory when doing so.

export MEMCACHED_SERVERS=/tmp/moxi.sock
export CCACHE_MEMCACHED_CONF=--SOCKET=\"/tmp/moxi.sock\"

You would need to start the host memcached proxy up first, though.
And also to configure it with the cluster configuration (or URL):

export MEMCACHED_SERVERS=localhost
moxi -s /tmp/moxi.sock -d -z 11311=localhost:11211


More information about the ccache mailing list