HUB
Sign inSign up

mpreu/squid

By mpreu

•Updated 19 days ago

Squid Container

Image
0

1.2K

mpreu/squid repository overview

⁠Squid Container Image

Container image for the Squid caching proxy⁠ based on Alpine Linux⁠.

⁠Getting the Image

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

⁠Configuration

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
⁠Command-line Parameters

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

⁠Persistent Cache and Logs

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 logs
podman 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

⁠Running as a Service

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
Tag summary
Recent tags
Content type
Image
Digest
sha256:549f385e3…
Size
10.6 MB
Last updated
19 days ago
docker pull mpreu/squid:7.6