Skip to content

Commit 653c4aa

Browse files
author
Stan Yagolnitser
committed
added route for quicker docker engine setup, just curl /setup | bash
1 parent a89cf36 commit 653c4aa

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

nginx.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,28 @@ http {
121121
alias /ca/ca.crt;
122122
}
123123

124+
location /setup {
125+
add_header "Content-type" "text/plain" always;
126+
return 200 '
127+
mkdir -p /etc/systemd/system/docker.service.d
128+
cat << EOD > /etc/systemd/system/docker.service.d/http-proxy.conf
129+
[Service]
130+
Environment="HTTPS_PROXY=$scheme://$http_host/"
131+
EOD
132+
133+
# Get the CA certificate from the proxy and make it a trusted root.
134+
curl $scheme://$http_host/ca.crt > /usr/share/ca-certificates/docker_registry_proxy.crt
135+
echo "docker_registry_proxy.crt" >> /etc/ca-certificates.conf
136+
update-ca-certificates --fresh
137+
138+
# Reload systemd
139+
systemctl daemon-reload
140+
141+
# Restart dockerd
142+
systemctl restart docker.service
143+
';
144+
}
145+
124146
# @TODO: add a dynamic root path that generates instructions for usage on docker clients
125147
}
126148

0 commit comments

Comments
 (0)