Skip to content

Instantly share code, notes, and snippets.

@jdeathe
Last active October 13, 2018 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdeathe/7129ca6b5831b056d17c6ecf45f6278c to your computer and use it in GitHub Desktop.
Save jdeathe/7129ca6b5831b056d17c6ecf45f6278c to your computer and use it in GitHub Desktop.
CentOS Docker Varnish Cache with Apache HTTP Backend

Docker - Varnish Cache with Apache HTTP Backend

Create Network

$ docker network create \
  --driver bridge \
  bridge_t1

Create Backend Container

The default VCL configuration requires a host named httpd_1.

$ docker rm -f httpd.1 &> /dev/null; \
  docker run \
    --detach \
    --name httpd.1 \
    --network bridge_t1 \
    --network-alias httpd_1 \
    jdeathe/centos-ssh-apache-php:3.1.0

Create Varnish Container

Older versions of Docker may require --link httpd_1.

$ docker rm -f varnish.1 &> /dev/null; \
  docker run \
    --detach \
    --tty \
    --name varnish.1 \
    --publish 80:80 \
    --network bridge_t1 \
    jdeathe/centos-ssh-varnish:2.2.0

Test with CURL

$ curl -I http://localhost/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment