jpetazzo / squid-in-a-can

361 stars 78 forks source link

Permission problems with persistent cache #6

Closed schmunk42 closed 7 years ago

schmunk42 commented 9 years ago

I was trying to mount a cache volume into my container, but got this error:

squid_1 | 2014/12/01 06:13:12 kid1| Making directories in /var/cache/squid3/00
squid_1 | FATAL: Failed to make swap directory /var/cache/squid3/00/00: (13) Permission denied

The directories get permissions of my user (on my host) and docker can't create the subdirectories...

$ ls -la tmp/squid3/
total 0
drwxrwxrwx+ 3 tobias  staff  102 Dec  1 23:52 .
drwxr-xr-x+ 3 tobias  staff  102 Dec  1 23:43 ..
drwxr-xr-x+ 2 tobias  staff   68 Dec  1 23:52 00

Running Docker 1.3.1 on OS X 10.10.

[addon] I was able to get it running on OS X (via docker host vm) by manually creating /var/cache/squid3/00 to /var/cache/squid3/0F and running chmod -R 777 path/to/volume.

tfoote commented 9 years ago

On my (host) machine the proxy user has permissions. Which I assume has the same UID inside and outside. drwxr-xr-x 18 proxy proxy 4096 Nov 30 23:46 squidcache

schmunk42 commented 9 years ago

I think another thing is, that squid is operating directly on the mount point - maybe it could be solved by telling squid to use /var/cache/squid/tmp or something similar.

codingtony commented 8 years ago

@schmunk42 Another work around that works on OSX. Using a data volume container :

docker run -v /var/cache/squid3   --name "squidcache" tianon/true
docker run --net host --name squid --volumes-from squidcache -d jpetazzo/squid-in-a-can 

The data is persisted in the container "squidcache"

One can see what's persisted with this command :

docker run --volumes-from squidcache  --rm -ti busybox

Once in the shell you can go to /var/cache/squid3