Container image for the Squid caching proxy based on Alpine Linux.
The container image is published on Dockerhub and can be accessed with e.g.:
podman pull docker.io/mpreu/squid:7.5
Alternatively, the image is also available in the Github Container Registry:
podman pull ghcr.io/mpreu/squid:7.5
To provide a squid.conf configuration file the mount point /etc/squid/squid.conf can be used:
podman run \
--name squid \
--volume /path/to/squid.conf:/etc/squid/squid.conf \
docker.io/mpreu/squid:7.5
For further customization additional command-line parameters are forwarded to Squid. For example, getting the current installed Squid version in the container can be displayed with:
podman run docker.io/mpreu/squid:7.5 --version
To allow persistent caches and logs during container shutdowns/restarts/... the following directories can be mapped to the host:
/var/spool/squid for caches/var/log/squid for logspodman run \
--name squid \
--volume /tmp/squid/cache:/var/spool/squid \
--volume /tmp/squid/log:/var/log/squid \
docker.io/mpreu/squid:7.5
In case persistent logs are not required, they can just be accessed with e.g.:
podman exec -it squid tail -f /var/log/squid/access.log
When running Squid in a container, one usual use-case is to have it running as a service. This can be achieved on a systemd system using the following example unit deployed to e.g. '/etc/systemd/system/squid.service':
[Unit]
Description=Squid container service
After=network-online.target
[Service]
Restart=always
ExecStartPre=-/usr/bin/podman stop %n
ExecStartPre=-/usr/bin/podman rm %n
ExecStart=/usr/bin/podman run --rm \
--name %n \
--security-opt label=disable \
-p 3128:3128 \
-v /path/to/squid.conf:/etc/squid/squid.conf \
docker.io/mpreu/squid:7.5
[Install]
WantedBy=default.target
The Squid container service can then be started and enabled with:
systemctl enable --now squid
docker pull mpreu/squid:7.6