Skip to content

Instantly share code, notes, and snippets.

@moycat
Created January 23, 2022 10:36
Show Gist options
  • Save moycat/9dbe59d806295d6e3f193e17ab9bf9fe to your computer and use it in GitHub Desktop.
Save moycat/9dbe59d806295d6e3f193e17ab9bf9fe to your computer and use it in GitHub Desktop.
#!/bin/bash -e
PROXY=""
export http_proxy="${PROXY}" https_proxy="${PROXY}"
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get remove docker docker-engine docker.io containerd runc
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
mkdir -p /etc/systemd/system/docker.service.d
cat <<EOF >/etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=${PROXY}" "HTTPS_PROXY=${PROXY}" "NO_PROXY=127.0.0.1/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,::1/128,fc00::/7"
EOF
systemctl daemon-reload
systemctl restart docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment