From 3aa9af014dfbf3439dd16d936d8d086bd0915f50 Mon Sep 17 00:00:00 2001 From: Will Rouesnel Date: Tue, 29 Mar 2016 13:19:20 +1100 Subject: [PATCH] Update README.md --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 788a46d..f464fc5 100644 --- a/README.md +++ b/README.md @@ -61,3 +61,30 @@ docker run -it -p 3128:127.0.0.1:3128 --rm \ Note that it doesn't really matter where we mount the certificate - the image launch script makes a copy as root to avoid messing with permissions anyway. + +## Unit File for systemd +This is an example of a systemd unit file to persistly start squid4: +``` +[Unit] +Description=Squid4 Docker Container +Documentation=http://wiki.squid.org +After=network.target docker.service +Requires=docker.service + +[Service] +ExecStartPre=-/usr/bin/docker kill squid4 +ExecStartPre=-/usr/bin/docker rm squid4 +ExecStart=/usr/bin/docker run --net=host --rm \ + -v /srv/squid/cache:/var/cache/squid4 \ + -v /etc/ssl/certs:/etc/ssl/certs:ro \ + -v /etc/ssl/private/local_mitm.pem:/local_mitm.pem:ro \ + -v /etc/ssl/certs/local_mitm.pem:/local_mitm.crt:ro \ + -e MITM_KEY=/local_mitm.pem \ + -e MITM_CERT=/local_mitm.crt \ + -e MITM_PROXY=yes \ + --name squid4 \ + squid + +[Install] +WantedBy=multi-user.target +```