Created
November 13, 2015 19:39
-
-
Save johnbintz/a0284678e7efc780cc1e to your computer and use it in GitHub Desktop.
squid-deb-proxy for docker, because bandwidth is a thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker run -it --name squid-deb-proxy-cache -v /var/cache/squid-deb-proxy busybox true | |
docker run -d --restart=always --name squid-deb-proxy --volumes-from squid-deb-proxy-cache -p 0.0.0.0:48000:8000 pmoust/squid-deb-proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this at the top of the dockerfile | |
# If host is running squid-deb-proxy on port 48000, populate /etc/apt/apt.conf.d/30proxy | |
# By default, squid-deb-proxy 403s unknown sources, so apt shouldn't proxy ppa.launchpad.net | |
RUN route -n | awk '/^0.0.0.0/ {print $2}' > /tmp/host_ip.txt | |
RUN echo -n "GET / HTTP/1.0\n\n" | nc `cat /tmp/host_ip.txt` 48000 \ | |
&& (echo "Acquire::http::Proxy \"http://$(cat /tmp/host_ip.txt):48000\";" > /etc/apt/apt.conf.d/30proxy) \ | |
&& (echo "Acquire::http::Proxy::ppa.launchpad.net DIRECT;" >> /etc/apt/apt.conf.d/30proxy) \ | |
|| echo "No squid-deb-proxy detected on docker host" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment