You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Configure Docker Desktop on Windows to use the proxy and trust its certificate
2
+
3
+
1. Let's say you set up the proxy on host `192.168.66.72`. Get the certificate using a browser (go to <http://192.168.66.72:3128/ca.crt>) and save it as a file (e.g., to `d:\ca.crt`)
4
+
5
+
1. Add the certificate to Windows:
6
+
7
+
1. Double click the certificate
8
+
1. Chose to _Install certificate..._, then click _Next_
9
+
1. Chose _Current user_, then click _Next_
10
+
1. Select option _Place all certificates in the following store_, click _browse_, and select _Trusted Root Certification Authorities_
11
+
1. Proceed with Ok and confirm to install the certificate
12
+
13
+
If you are not using the WSL2 backend for Docker, then restart Docker Desktop and skip the next step.
14
+
15
+
1. If you are using WSL2 for Docker, then you need to add the certificate to WSL too:
16
+
17
+
1. Open a terminal
18
+
19
+
1. Check the name of the WSL distribution:
20
+
21
+
```
22
+
PS C:\> wsl --list
23
+
Windows Subsystem for Linux Distributions:
24
+
docker-desktop (Default)
25
+
docker-desktop-data
26
+
```
27
+
28
+
The distribution we are looking for is _docker-desktop_. If you installed another distribution, such as Ubuntu, and configured Docker to use that, and proceed with that distribution instead.
29
+
30
+
1. Get a shell into WSL
31
+
32
+
```
33
+
PS C:\> wsl --distribution docker-desktop
34
+
XXXYYYZZZ:/tmp/docker-desktop-root/mnt/host/c#
35
+
```
36
+
37
+
1. Copy the certificate into WSL and import it
38
+
39
+
Note: The directory and the command below are for the _docker-desktop_ WSL distribution. On other systems you might need to tweak the commands a little, but they seem to be the same for [Ubuntu](https://www.pmichaels.net/2020/12/29/add-certificate-into-wsl/) and [Debian](https://github.com/microsoft/WSL/issues/3161#issue-320777324) as well.
WARNING: ca-certificates.crt does not contain exactly one certificate or CRL: skipping
45
+
```
46
+
47
+
Don't mind the warning, the operation still succeeded.
48
+
49
+
1. We are done with WSL, you can `exit` this shell
50
+
51
+
1. Configure the proxy in Docker Desktop:
52
+
53
+
1. Open Docker Desktop settings
54
+
1. Go to _Resources/Proxies_
55
+
1. Enable the proxy and set `http://192.168.66.72:3128` as both the HTTP and HTTPS URL.
56
+
57
+
1. Done. Verify that pulling works:
58
+
59
+
```
60
+
# execute this in a Windows shell, not in WSL
61
+
docker pull hello-world
62
+
```
63
+
64
+
You can check the logs of the proxy to confirm that it was used.
65
+
66
+
If pulling does not work and complains about not trusting the certificate then Docker and/or the WSL distribution might need a restart. You might try restarting Docker, or you can restart Windows too to force WSL to restart.
Copy file name to clipboardExpand all lines: README.md
+89-4Lines changed: 89 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,10 @@ for this to work it requires inserting a root CA certificate into system trusted
87
87
-`hostname`s listed here should be listed in the REGISTRIES environment as well, so they can be intercepted.
88
88
- Env `AUTH_REGISTRIES_DELIMITER` to change the separator between authentication info. By default, a space: "``". If you use keys that contain spaces (as with Google Cloud Registry), you should update this variable, e.g. setting it to `AUTH_REGISTRIES_DELIMITER=";;;"`. In that case, `AUTH_REGISTRIES` could contain something like `registry1.com:user1:pass1;;;registry2.com:user2:pass2`.
89
89
- Env `AUTH_REGISTRY_DELIMITER` to change the separator between authentication info *parts*. By default, a colon: "`:`". If you use keys that contain single colons, you should update this variable, e.g. setting it to `AUTH_REGISTRIES_DELIMITER=":::"`. In that case, `AUTH_REGISTRIES` could contain something like `registry1.com:::user1:::pass1 registry2.com:::user2:::pass2`.
90
+
- Env `PROXY_REQUEST_BUFFERING`: If push is allowed, buffering requests can cause issues on slow upstreams.
91
+
If you have trouble pushing, set this to `false` first, then fix remainig timeouts.
92
+
Default is `true` to not change default behavior.
93
+
ENV PROXY_REQUEST_BUFFERING="true"
90
94
- Timeouts ENVS - all of them can pe specified to control different timeouts, and if not set, the defaults will be the ones from `Dockerfile`. The directives will be added into `http` block.:
91
95
- SEND_TIMEOUT : see [send_timeout](http://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout)
92
96
- CLIENT_BODY_TIMEOUT : see [client_body_timeout](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout)
## Configuring the Docker clients using Docker Desktop for Mac
180
265
181
266
Separate instructions for Mac clients available in [this dedicated Doc Desktop for Mac document](Docker-for-Mac.md).
@@ -256,9 +341,9 @@ docker run --rm --name docker_registry_proxy -it
256
341
- If you authenticate to a private registry and pull through the proxy, those images will be served to any client that can reach the proxy, even without authentication. *beware*
257
342
- Repeat, **this will make your private images very public if you're not careful**.
258
343
-~~**Currently you cannot push images while using the proxy** which is a shame. PRs welcome.~~**SEE `ALLOW_PUSH` ENV FROM USAGE SECTION.**
259
-
- Setting this on Linux is relatively easy.
260
-
- On Mac and Windows the CA-certificate part will be very different but should work in principle.
261
-
-Please send PRs with instructions for Windows and Mac if you succeed!
344
+
- Setting this on Linux is relatively easy.
345
+
- On Mac follow the instructions [here](Docker-for-Mac.md).
346
+
-On Windows follow the instructions [here](Docker-Desktop-Windows.md).
262
347
263
348
### Why not use Docker's own registry, which has a mirror feature?
264
349
@@ -280,7 +365,7 @@ Yeah. Docker Inc should do it. So should NPM, Inc. Wonder why they don't. 😼
-[ ] Test and make auth work with quay.io, unfortunately I don't have access to it (_hint, hint, quay_)
285
370
-[x] Hide the mitmproxy building code under a Docker build ARG.
286
371
-[ ] "Developer Office" proxy scenario, where many developers on a fast LAN share a proxy for bandwidth and speed savings (already works for pulls, but messes up pushes, which developers tend to use a lot)
0 commit comments