File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments