- Getting started
Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.
If you find this image useful here's how you can help:
- Send a pull request with your awesome features and bug fixes
- Help users resolve their issues.
- Support the development of this image with a donation
Before reporting your issue please try updating Docker to the latest version and check if it resolves the issue. Refer to the Docker installation guide for instructions.
SELinux users should try disabling SELinux using the command
setenforce 0 to see if it resolves the issue.
If the above recommendations do not help then report your issue along with the following information:
- Output of the
docker runcommand or
docker-compose.ymlused to start the image. Mask out the sensitive bits.
- Please state if you are using Boot2Docker, VirtualBox, etc.
Automated builds of the image are available on Dockerhub and is the recommended method of installation.
Note: Builds are also available on Quay.io
docker pull sameersbn/squid:3.3.8-23
Alternatively you can build the image yourself.
docker build -t sameersbn/squid github.com/sameersbn/docker-squid
Start Squid using:
docker run --name squid -d --restart=always \ --publish 3128:3128 \ --volume /srv/docker/squid/cache:/var/spool/squid3 \ sameersbn/squid:3.3.8-23
You can customize the launch command of the Squid server by specifying arguments to
squid3 on the
docker run command. For example the following command prints the help menu of
docker run --name squid -it --rm \ --publish 3128:3128 \ --volume /srv/docker/squid/cache:/var/spool/squid3 \ sameersbn/squid:3.3.8-23 -h
For the cache to preserve its state across container shutdown and startup you should mount a volume at
The Quickstart command already mounts a volume for persistence.
SELinux users should update the security context of the host mountpoint so that it plays nicely with Docker:
mkdir -p /srv/docker/squid chcon -Rt svirt_sandbox_file_t /srv/docker/squid
Squid is a full featured caching proxy server and a large number of configuration parameters. To configure Squid as per your requirements edit the default squid.conf and volume mount it at
docker run --name squid -d --restart=always \ --publish 3128:3128 \ --volume /path/to/squid.conf:/etc/squid3/squid.conf \ --volume /srv/docker/squid/cache:/var/spool/squid3 \ sameersbn/squid:3.3.8-23
To reload the Squid configuration on a running instance you can send the
HUP signal to the container.
docker kill -s HUP squid
Configure your web browser network/connection settings to use the proxy server which is available at
If you are using Linux then you can also add the following lines to your
.bashrc file allowing command line applications to use the proxy server for outgoing connections.
export ftp_proxy=http://172.17.42.1:3128 export http_proxy=http://172.17.42.1:3128 export https_proxy=http://172.17.42.1:3128
To use Squid in your Docker containers add the following line to your
ENV http_proxy=http://172.17.42.1:3128 \ https_proxy=http://172.17.42.1:3128 \ ftp_proxy=http://172.17.42.1:3128
To access the Squid logs, located at
/var/log/squid3/, you can use
docker exec. For example, if you want to tail the access logs:
docker exec -it squid tail -f /var/log/squid3/access.log
You can also mount a volume at
/var/log/squid3/ so that the logs are directly accessible on the host.
To upgrade to newer releases:
Download the updated Docker image:
docker pull sameersbn/squid:3.3.8-23
Stop the currently running image:
docker stop squid
Remove the stopped container
docker rm -v squid
Start the updated image
docker run -name squid -d \ [OPTIONS] \ sameersbn/squid:3.3.8-23
For debugging and maintenance purposes you may want access the containers shell. If you are using Docker version
1.3.0 or higher you can access a running containers shell by starting
docker exec -it squid bash
is there a entrypoint foreseen?
I wish to create my container the classic way, like this:
docker create --name="squid" \
-v /mnt/docker-volumes-nfs/squid/config/squid.conf:/etc/squid3/squid.conf \
-v /mnt/docker-volumes-nfs/squid/cache:/var/spool/squid3 \
-e PGID=1001 \
-e PUID=1001 \
-e TZ=Europe/Brussels \
-p 3128:3128 \
--ip 10.10.35.2 \
--net docker1 \
it seems however that squid keeps restarting.
my squid.conf on my volume certainly works with this script version.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
73187860d811 sameersbn/squid:3.3.8-23 "/sbin/entrypoint.sh" 30 seconds ago Restarting (1) 11 seconds ago squid
I'd like to get Squid set up to block ads for the machines on my network. I've looked at a guide here (https://calomel.org/squid_adservers.html), which doesn't look too difficult but it does require a cron job to keep the ad list up to date. Is something like that possible with your version of Squid? Or maybe something that is implementable?