docker-squid icon indicating copy to clipboard operation
docker-squid copied to clipboard

Reload the Squid configuration on a running instance

Open jackmiemie opened this issue 7 years ago • 1 comments

Hi,

This is a suggestion to revise the method to reload the squid configuration on a running instance.

I have used sameersbn/squid:3.3.8-23 and it work nice until I try to reload the squid configuration on a running instance. I found that after typing docker kill -s HUP squid to my terminal, squid shows the same configuration as before. I try a lot of ways to figure out the problem, but only to find that it was the problem of mounting the squid.conf.

Here is the detail.

I create and run sameersbn/squid:3.3.8-23 following the instruction in README.md:

docker run -d --name squid --restart=always --publish 3128:3128 --volume /etc/squid/squid.conf:/etc/squid3/squid.conf --volume /var/spool/squid3:/var/spool/squid3 sameersbn/squid:3.3.8-23

This works nice, however, when you try to reload squid.conf on the running instance using:

docker kill -s HUP squid

You will find the configuration of squid doesn't change at all. After a lot of miserable reading of docker issues, I found the problem. Docker can not detect the mounted file changes unless you mount the directory. In my situation, I create a new container and mount my squid.conf directory, then HUP works. That is:

docker run -d --name squid --restart=always --publish 3128:3128 --volume /etc/squid/squid.conf:/etc/squid3/squid.conf --volume /etc/squid:/etc/squid3 --volume /var/spool/squid3:/var/spool/squid3 sameersbn/squid:3.3.8-23

The magic is --volume /etc/squid:/etc/squid3

I hope my experience could help new guys like me. 😃

jackmiemie avatar Apr 25 '18 05:04 jackmiemie

Try mount volume only as directory:

docker run -p 3128:3128  -v /etc/squid:/etc/squid sameersbn/squid:3.5.27-2

helphi avatar Jul 17 '20 04:07 helphi