Simple Squid on Docker Setup

Prerequisites

  • Linux Debian Jessie
  • root access

Install Docker

Add the following to /etc/apt/sources.list.d/docker.list

deb https://apt.dockerproject.org/repo debian-jessie main

Install Docker and some required dependencies:

apt-get update
apt-get install apt-transport-https ca-certificates apache2-utils docker-engine
service docker start

Squid

add this to /srv/docker/squid/squid.conf (example squid.conf)

auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/squid_passwd
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

Create the password file

touch /srv/docker/squid/squid_passwd
chown proxy /srv/docker/squid/squid_passwd
htpasswd /srv/docker/squid/squid_passwd user1

Get the docker image:

docker pull sameersbn/squid:latest

Run the docker container

docker run --name squid -d --restart=always   --publish 3128:3128   \
--volume /srv/docker/squid/squid.conf:/etc/squid3/squid.conf   \
--volume /srv/docker/squid/cache:/var/spool/squid3   \
--volume /srv/docker/squid/squid_passwd:/etc/squid/squid_passwd   \
sameersbn/squid:latest

Checks

Check your proxy setup like this

curl -x your.proxy.com:3128 -U username:password https://what.digital

Sources