Skip to content

Instantly share code, notes, and snippets.

@kou1okada
Last active December 20, 2020 03:39
Show Gist options
  • Save kou1okada/0e248dc5be5e7cea224ccbfa530b5e0d to your computer and use it in GitHub Desktop.
Save kou1okada/0e248dc5be5e7cea224ccbfa530b5e0d to your computer and use it in GitHub Desktop.
docker-squid
FROM ubuntu
MAINTAINER kou1okada <[email protected]>
env DEBIAN_FRONTEND=noninteractive
RUN \
sed -i -E 's@https?://[^ ]+@http://mirrors.evowise.com/ubuntu/@g' /etc/apt/sources.list && \
apt-get update &&\
apt-get install -y --no-install-recommends squid &&\
apt-get clean &&\
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime &&\
dpkg-reconfigure tzdata &&\
echo "Phase 1, done." &&\
echo
COPY run /tmp/
RUN \
mv -v /tmp/run /usr/local/bin/ &&\
sed -i -E 's/^#(http_access allow localnet)/\1/g' /etc/squid/squid.conf &&\
echo "Phase 2, done." &&\
echo "All, done." &&\
echo
EXPOSE 3128
CMD ["/usr/local/bin/run"]
This project is distributed under the MIT license.
See https://opensource.org/licenses/MIT
Copyright 2020 kou1okada
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.PHONY: all clean run shell
all:
sudo docker build -t squid .
run:
sudo docker run -it --rm -h squid --name squid squid
shell:
sudo docker run -it --rm squid bash
#!/usr/bin/env bash
echo "http://$(hostname -i):3128/"
squid -N
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment