SRC: https://www.squid-cache.org/Versions/
Example docker-compose snippet:
squid:
image: h0tmann/squid:v7.7
container_name: squid
network_mode: host
environment:
# TIME
- TZ=Europe/Berlin
- LANG=de_DE.UTF-8
# ENV
# - PORT=3128 # default "3128"
# - ALLOW_CIDR=10.0.0.0/8;fd00::/8 # default "10.0.0.0/8" | list, ";" or "," separated
# - ALLOW_PORTS=80;443;8081 # default "Safe_ports" | list, ";" or "," separated, port or range
# - BLOCK_PRIVATE_IPS=true # default "true" | deny RFC1918 / CGNAT / ULA targets
# - BLOCK_LOOPBACK=true # default "true" | deny 127.0.0.0/8 and ::1 targets
# - VISIBLE_HOSTNAME=squid # default "squid" | appears in Via and on error pages
# - CACHE_MEM=32 # default "32" | memory cache in MB
# - LOGFILE=/var/log/squid/access.log # default "/var/log/squid/access.log" | set empty for stdout only
# - SQUID_LOG_ROTATE=10 # default "10" | kept rotations, needs an external "squid -k rotate"
# - SQUID_GRACEFULL_SHUTDOWN=7 # default "7" | seconds, 7 is the ceiling (docker stop kills at 10s)
volumes:
# TIME
- "/etc/localtime:/etc/localtime:ro"
# LOGS
- "/var/log/squid/:/var/log/squid/:rw"
deploy:
resources:
limits:
memory: 64M
restart: unless-stopped
Run Log-Rotation:
docker exec squid /usr/sbin/squid -k rotate -f /etc/squid/squid.conf
after adding the docker compose run this quick-snippet:
mkdir -p /var/log/squid/ && chown 850:850 /var/log/squid/ && \
docker compose -f /var/docker/compose/docker-compose.yml pull && \
docker compose -f /var/docker/compose/docker-compose.yml up -d --remove-orphans && \
docker logs -f squid
Test functionality with one of these commands:
curl -x http://127.0.0.1:3128 -v http://example.com
curl -x http://127.0.0.1:3128 -v https://example.com
curl -6 -x "http://[::1]:3128" -v https://example.com
Content type
Image
Digest
sha256:32cd0fc07…
Size
2.3 MB
Last updated
11 days ago
docker pull h0tmann/squid:v7.7