added route for quicker docker engine setup, just curl /setup | bash

pull/8/head
Stan Yagolnitser 2018-12-12 00:42:40 -08:00
parent a89cf362ad
commit 653c4aad54
1 changed files with 22 additions and 0 deletions

View File

@ -121,6 +121,28 @@ http {
alias /ca/ca.crt; alias /ca/ca.crt;
} }
location /setup {
add_header "Content-type" "text/plain" always;
return 200 '
mkdir -p /etc/systemd/system/docker.service.d
cat << EOD > /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTPS_PROXY=$scheme://$http_host/"
EOD
# Get the CA certificate from the proxy and make it a trusted root.
curl $scheme://$http_host/ca.crt > /usr/share/ca-certificates/docker_registry_proxy.crt
echo "docker_registry_proxy.crt" >> /etc/ca-certificates.conf
update-ca-certificates --fresh
# Reload systemd
systemctl daemon-reload
# Restart dockerd
systemctl restart docker.service
';
}
# @TODO: add a dynamic root path that generates instructions for usage on docker clients # @TODO: add a dynamic root path that generates instructions for usage on docker clients
} }