• Stars
    star
    818
  • Rank 55,733 (Top 2 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 10 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dockerfile to create a Docker container image for Squid proxy server

Circle CI Docker Repository on Quay.io

sameersbn/squid:3.5.27-2

Introduction

Dockerfile to create a Docker container image for Squid proxy server.

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.

Contributing

If you find this image useful here's how you can help:

  • Send a pull request with your awesome features and bug fixes
  • Help users resolve their issues.
  • Support the development of this image with a donation

Issues

Before reporting your issue please try updating Docker to the latest version and check if it resolves the issue. Refer to the Docker installation guide for instructions.

SELinux users should try disabling SELinux using the command setenforce 0 to see if it resolves the issue.

If the above recommendations do not help then report your issue along with the following information:

  • Output of the docker version and docker info commands
  • The docker run command or docker-compose.yml used to start the image. Mask out the sensitive bits.
  • Please state if you are using Boot2Docker, VirtualBox, etc.

Getting started

Installation

Automated builds of the image are available on Dockerhub and is the recommended method of installation.

Note: Builds are also available on Quay.io

docker pull sameersbn/squid:3.5.27-2

Alternatively you can build the image yourself.

docker build -t sameersbn/squid github.com/sameersbn/docker-squid

Quickstart

Start Squid using:

docker run --name squid -d --restart=always \
  --publish 3128:3128 \
  --volume /srv/docker/squid/cache:/var/spool/squid \
  sameersbn/squid:3.5.27-2

Alternatively, you can use the sample docker-compose.yml file to start the container using Docker Compose

Command-line arguments

You can customize the launch command of the Squid server by specifying arguments to squid on the docker run command. For example the following command prints the help menu of squid command:

docker run --name squid -it --rm \
  --publish 3128:3128 \
  --volume /srv/docker/squid/cache:/var/spool/squid \
  sameersbn/squid:3.5.27-2 -h

Persistence

For the cache to preserve its state across container shutdown and startup you should mount a volume at /var/spool/squid.

The Quickstart command already mounts a volume for persistence.

SELinux users should update the security context of the host mountpoint so that it plays nicely with Docker:

mkdir -p /srv/docker/squid
chcon -Rt svirt_sandbox_file_t /srv/docker/squid

Configuration

Squid is a full featured caching proxy server and a large number of configuration parameters. To configure Squid as per your requirements mount your custom configuration at /etc/squid/squid.conf.

docker run --name squid -d --restart=always \
  --publish 3128:3128 \
  --volume /path/to/squid.conf:/etc/squid/squid.conf \
  --volume /srv/docker/squid/cache:/var/spool/squid \
  sameersbn/squid:3.5.27-2

To reload the Squid configuration on a running instance you can send the HUP signal to the container.

docker kill -s HUP squid

Usage

Configure your web browser network/connection settings to use the proxy server which is available at 172.17.0.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=http://172.17.0.1:3128
export http_proxy=http://172.17.0.1:3128
export https_proxy=http://172.17.0.1:3128

To use Squid in your Docker containers add the following line to your Dockerfile.

ENV http_proxy=http://172.17.0.1:3128 \
    https_proxy=http://172.17.0.1:3128 \
    ftp_proxy=http://172.17.0.1:3128

Logs

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.

Maintenance

Upgrading

To upgrade to newer releases:

  1. Download the updated Docker image:
docker pull sameersbn/squid:3.5.27-2
  1. Stop the currently running image:
docker stop squid
  1. Remove the stopped container
docker rm -v squid
  1. Start the updated image
docker run -name squid -d \
  [OPTIONS] \
  sameersbn/squid:3.5.27-2

Shell Access

For debugging and maintenance purposes you may want access the containers shell. If you are using Docker version 1.3.0 or higher you can access a running containers shell by starting bash using docker exec:

docker exec -it squid bash

More Repositories

1

docker-gitlab

Dockerized GitLab
Shell
7,893
star
2

docker-redmine

Docker Image for Redmine
Shell
1,255
star
3

docker-postgresql

Dockerfile to build a PostgreSQL container image which can be linked to other containers.
Shell
1,050
star
4

docker-bind

Dockerize BIND DNS server with webmin for DNS administration
Shell
913
star
5

docker-browser-box

Dockerized google-chome and tor-browser with audio support via pulseaudio
Shell
574
star
6

docker-mysql

A Dockerfile that installs a mysql server
Shell
247
star
7

docker-apt-cacher-ng

Dockerfile to create a Docker container image for Apt-Cacher NG
Shell
210
star
8

docker-gitlab-ci

Dockerfile to build a GitLab CI container image.
Shell
199
star
9

docker-redis

Dockerfile to create a Docker container image for Redis.
Shell
156
star
10

docker-gitlab-ci-multi-runner

Shell
145
star
11

docker-skype

Dockerized skype with voice and video call support
Shell
139
star
12

docker-gitlab-ci-runner

Dockerfile to build a base GitLab CI Runner container image.
Shell
98
star
13

docker-openfire

Dockerfile to create a Docker container image for Openfire.
Shell
81
star
14

docker-nginx

A Dockerfile that installs nginx (from source) with nginx-rtmp module support (php5 support can be added using the sameersbn/php5-fpm image)
Shell
76
star
15

docker-wowza

Dockerfile to containerize Wowza Streaming Engine
Shell
64
star
16

docker-mongodb

Dockerfile to build a MongoDb container image which can be linked to other containers.
Shell
47
star
17

docker-invoiceplane

Dockerfile to create a Docker container image for InvoicePlane
Shell
45
star
18

docker-owncloud

Experimental owncloud image for docker
Shell
34
star
19

docker-ubuntu

My Ubuntu boilerplate image that forms the base for my docker containers.
Makefile
33
star
20

docker-nextcloud

Shell
31
star
21

docker-runner-gitlab

A CI runner for gitlab-ce built on top of the https://github.com/sameersbn/docker-gitlab-ci-runner
Shell
27
star
22

docker-memcached

Dockerfile to build a memcached container image which can be linked to other containers.
Dockerfile
27
star
23

docker-extras

Helper scripts for everyday docker use.
Shell
19
star
24

docker-akaunting

Docker for Akaunting
Shell
19
star
25

docker-ffmpeg

Base your docker image on this image if you need a bleeding egde version of fffmpeg.
Shell
17
star
26

docker-laboard

Docker file to build a Laboard image
Shell
10
star
27

docker-php-fpm

Dockerfile to build a php-fpm container.
Dockerfile
8
star
28

docker-nodejs

Dockerfile to build a nodejs+express image with nodemon
Shell
7
star
29

docker-rygel

Dockerfile to build a Rygel DLNA/uPNP server docker image.
Makefile
7
star
30

docker-skypeforlinux

Dockerized Skype for Linux (alpha)
Shell
6
star
31

docker-mysql2psql

Dockerfile that packages mysql2psql and py-mysql2pqsql tools.
Makefile
6
star
32

docker-debian

debian jessie baseimage that packs a couple of extra packages.
Makefile
2
star