(thanks Sameer Naik - sameersbn)
Start Squid using:
docker run --name squid -d --restart=always \
--publish 3128:3128 \
--volume /srv/docker/squid/:/squid \
babim/squid
Volume dir:
/squid/cache
/squid/log
/squid/config
The user must specify authentication credentials via the following environment variables:
-e AUTH=true
USERNAME=foo (default)
PASSWORD=bar (default)
You can access from internet via the following environment variables:
-e PUBLIC=true
Configure your web browser network/connection settings to use the proxy server which is available at 172.17.42.1:3128
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=https://172.17.42.1:3128
export http_proxy=https://172.17.42.1:3128
export https_proxy=https://172.17.42.1:3128
To use Squid in you Docker containers add the following line to your Dockerfile
.
ENV http_proxy=https://172.17.42.1:3128 \
https_proxy=https://172.17.42.1:3128 \
ftp_proxy=https://172.17.42.1:3128
To access the Squid logs, located at /var/log/squid/
, you can use docker exec
. For example, if you want to tail the access logs:
docker exec -it squid tail -f /var/log/squid/access.log
You can also mount a volume at /var/log/squid/
so that the logs are directly accessible on the host.