Minimal alpine Squid Docker-Image with Configuration-Template
Pkg Source: https://pkgs.alpinelinux.org/packages?name=squid
Example docker-compose snippet:
alpine_squid:
container_name: alpine_squid
image: h0tmann/alpine_squid:latest
hostname: alpine_squid
network_mode: host
environment:
- TZ=Europe/Berlin # German time it alays good 🇩🇪
- LANG=de_DE.UTF-8 # German locale it alays good 🇩🇪
- SQUID_PORT=3128 # mostly "3128"
- CIDRS= # is a CSV with ; seperation and within a comma-seperation. Example:
# "CIDRS=203,10.4.203.0/24;204,10.4.204.0/24". this is just a "name,subnet;name2,subnet2" List
- SQUID_LOG_ROTATE=10 # default: 10
- SQUID_GRACEFULL_SHUTDOWN=5 # default: 5
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/var/log/squid/:/var/log/squid/:rw"
- "/var/docker/data/squid/config/:/etc/squid/conf.d/:rw"
- "/var/docker/data/squid/cache/:/var/cache/squid/:rw"
dns:
- 1.1.1.1
- 8.8.8.8
deploy:
resources:
limits:
memory: 500M # adjust to your needs
restart: unless-stopped
to use your own custom config run the container once and then copy it out:
docker cp alpine_dante:/etc/squid/ ./config/
and mount/overwrite the whole "/etc/squid/" folder by mounting it:
volumes:
- "./config/:/etc/squid/conf.d/:rw"
then modify it in the way you need.
Note: you can run this docker-compose either with:
ports:
- 3128:3128
sysctls:
- net.ipv6.conf.all.disable_ipv6=0 # explicitely disable the disableing of IPv6
- net.ipv6.conf.eth0.proxy_ndp=1 # other IPv6 tweak
or with
network_mode: host
but please keep in mind, that without network_mode: host, the rules in the config may need to be altered to have the wanted effect.
As all requests are comming through the docker-network your docker-container is in.
I personally recommend network_mode: host, as it also makes it way more easy to migrate from a plain installation to this dockerized version.
Read Squid Changelog here: https://github.com/squid-cache/squid/blob/master/ChangeLog
Build the container and have fun!
Content type
Image
Digest
sha256:0bb21bf62…
Size
10.5 MB
Last updated
about 1 month ago
docker pull h0tmann/alpine_squid:c_v7.6