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
<!--Delete sections as needed -->
## Description
Follow up to #23626.
Pivots the current content to more how-to type content (no new content
added), removes repetitions, add more cross-links
## Related issues or tickets
<!-- Related issues, pull requests, or Jira tickets -->
## Reviews
<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->
- [ ] Technical review
- [ ] Editorial review
- [ ] Product review
---------
Co-authored-by: Usha Mandya <[email protected]>
Docker Desktop includes built-in networking capabilities to help you connect containers with services on your host, across containers, or through proxies and VPNs.
17
+
This page explains how to configure and use networking features, connect containers to host services, work behind proxies or VPNs, and troubleshoot common issues.
18
18
19
-
## Networking features for all platforms
19
+
For details on how Docker Desktop routes network traffic and file I/O between containers, the VM, and the host, see [Network overview](/manuals/desktop/features/networking/index.md#overview).
20
20
21
-
### VPN Passthrough
21
+
## Core networking how-tos
22
+
23
+
### Connect a container to a service on the host
24
+
25
+
The host has a changing IP address, or none if you have no network access. To connect to services running on your host, use the special DNS name:
|`host.docker.internal`| Resolves to the internal IP address of your host |
30
+
|`gateway.docker.internal`| Resolves to the gateway IP of the Docker VM |
22
31
23
-
Docker Desktop networking can work when attached to a VPN. To do this,
24
-
Docker Desktop intercepts traffic from the containers and injects it into
25
-
the host as if it originated from the Docker application.
26
32
27
-
###Port mapping
33
+
#### Example
28
34
29
-
When you run a container with the `-p` argument, for example:
35
+
Run a simple HTTP server on port `8000`:
30
36
31
37
```console
32
-
$ docker run -p 80:80 -d nginx
38
+
$ python -m http.server 8000
33
39
```
34
40
35
-
Docker Desktop makes whatever is running on port `80` in the container, in
36
-
this case, `nginx`, available on port `80` of `localhost`. In this example, the
37
-
host and container ports are the same.
41
+
Then run a container, install `curl`, and try to connect to the host using the following commands:
38
42
39
-
To avoid conflicts with services already using port `80` on the host:
43
+
```console
44
+
$ docker run --rm -it alpine sh
45
+
# apk add curl
46
+
# curl http://host.docker.internal:8000
47
+
# exit
48
+
```
49
+
50
+
### Connect to a container from the host
51
+
52
+
To access containerized services from your host or local network, publish ports with the `-p` or `--publish` flag. For example:
40
53
41
54
```console
42
-
$ docker run -p 8000:80 -d nginx
55
+
$ docker run -d -p 80:80 --name webserver nginx
43
56
```
44
57
45
-
Now connections to `localhost:8000` are sent to port `80` in the container.
58
+
Docker Desktop makes whatever is running on port `80` in the container, in
59
+
this case, `nginx`, available on port `80` of `localhost`.
46
60
47
61
> [!TIP]
48
62
>
49
63
> The syntax for `-p` is `HOST_PORT:CLIENT_PORT`.
50
64
51
-
### HTTP/HTTPS Proxy support
65
+
To publish all ports, use the `-P` flag. For example, the following command
66
+
starts a container (in detached mode) and the `-P` flag publishes all exposed ports of the
67
+
container to random ports on the host.
68
+
69
+
```console
70
+
$ docker run -d -P --name webserver nginx
71
+
```
72
+
73
+
Alternatively, you can also use [host networking](/manuals/engine/network/drivers/host.md#docker-desktop)
74
+
to give the container direct access to the network stack of the host.
75
+
76
+
See the [run command](/reference/cli/docker/container/run.md) for more details on
77
+
publish options used with `docker run`.
78
+
79
+
All inbound connections pass through the Docker Desktop backend process (`com.docker.backend` (Mac), `com.docker.backend` (Windows), or `qemu` (Linux), which handles port forwarding into the VM.
80
+
For more details, see [How exposed ports work](/manuals/desktop/features/networking/index.md#how-exposed-ports-work)
52
81
53
-
See [Proxies](/manuals/desktop/settings-and-maintenance/settings.md#proxies)
82
+
### Working with VPNs
54
83
55
-
### SOCKS5 proxy support
84
+
Docker Desktop networking can work when attached to a VPN.
To do this, Docker Desktop intercepts traffic from the containers and injects it into
87
+
the host as if it originated from the Docker application.
58
88
59
-
SOCKS (Socket Secure) is a protocol that facilitates the routing of network packets between a client and a server through a proxy server. It provides a way to enhance privacy, security, and network performance for users and applications.
89
+
For details about how this traffic appears to host firewalls and endpoint detection systems, see [Firewalls and endpoint visibility](/manuals/desktop/features/networking/index.md#firewalls-and-endpoint-visibility.md).
60
90
61
-
You can enable SOCKS proxy support to allow outgoing requests, such as pulling images, and access Linux container backend IPs from the host.
91
+
### Working with proxies
62
92
63
-
To enable and set up SOCKS proxy support:
93
+
Docker Desktop can use your system proxy or a manual configuration.
94
+
To configure proxies:
64
95
65
96
1. Navigate to the **Resources** tab in **Settings**.
66
97
2. From the dropdown menu select **Proxies**.
67
-
3. Switch on the **Manual proxy configuration** toggle.
68
-
4.In the **Secure Web Server HTTPS** box, paste your `socks5://host:port` URL.
98
+
3. Switch on the **Manual proxy configuration** toggle.
99
+
4.Enter your HTTP, HTTPS or SOCKS5 proxy URLS.
69
100
70
-
## Networking mode and DNS behaviour for Mac and Windows
101
+
For more details on proxies and proxy configurations, see the [Proxy settings documentation](/manuals/desktop/settings-and-maintenance/settings.md#proxies).
71
102
72
-
With Docker Desktop version 4.42 and later, you can customize how Docker handles container networking and DNS resolution to better support a range of environments — from IPv4-only to dual-stack and IPv6-only systems. These settings help prevent timeouts and connectivity issues caused by incompatible or misconfigured host networks.
103
+
## Network how-tos for Mac and Windows
104
+
105
+
With Docker Desktop version 4.42 and later, you can control how Docker handles container networking and DNS resolution to better support a range of environments — from IPv4-only to dual-stack and IPv6-only systems. These settings help prevent timeouts and connectivity issues caused by incompatible or misconfigured host networks.
106
+
107
+
You can set the following settings on the **Network** tab in the Docker Desktop Dashboard settings, or if you're an admin, with Settings Management via the [`admin-settings.json` file](/manuals/enterprise/security/hardened-desktop/settings-management/configure-json-file.md#networking), or the [Admin Console](/manuals/enterprise/security/hardened-desktop/settings-management/configure-admin-console.md)
73
108
74
109
> [!NOTE]
75
110
>
@@ -79,123 +114,28 @@ With Docker Desktop version 4.42 and later, you can customize how Docker handles
79
114
80
115
Choose the default IP protocol used when Docker creates new networks. This allows you to align Docker with your host’s network capabilities or organizational requirements, such as enforcing IPv6-only access.
81
116
82
-
The options available are:
83
-
84
-
-**Dual IPv4/IPv6** (Default): Supports both IPv4 and IPv6. Most flexible and ideal for environments with dual-stack networking.
85
-
-**IPv4 only**: Only IPv4 addresses are used. Use this if your host or network does not support IPv6.
86
-
-**IPv6 only**: Only IPv6 addresses are used. Best for environments transitioning to or enforcing IPv6-only connectivity.
87
-
88
-
> [!NOTE]
89
-
>
90
-
> This setting can be overridden on a per-network basis using CLI flags or Compose file options.
|**Dual IPv4/IPv6 (default)**| Supports both IPv4 and IPv6. Most flexible. |
120
+
|**IPv4 only**| Uses only IPv4 addressing. |
121
+
|**IPv6 only**| Uses only IPv6 addressing. |
91
122
92
123
### DNS resolution behavior
93
124
94
125
Control how Docker filters DNS records returned to containers, improving reliability in environments where only IPv4 or IPv6 is supported. This setting is especially useful for preventing apps from trying to connect using IP families that aren't actually available, which can cause avoidable delays or failures.
95
126
96
-
Depending on your selected network mode, the options available are:
97
-
98
-
-**Auto (recommended)**: Docker detects your host's network stack and automatically filters out unsupported DNS record types (A for IPv4, AAAA for IPv6).
99
-
-**Filter IPv4 (A records)**: Prevents containers from resolving IPv4 addresses. Only available in dual-stack mode.
100
-
-**Filter IPv6 (AAAA records)**: Prevents containers from resolving IPv6 addresses. Only available in dual-stack mode.
101
-
-**No filtering**: Docker returns all DNS records (A and AAAA), regardless of host support.
|**Auto (recommended)**| Automatically filters unsupported record types. (A for IPv4, AAAA for IPv6)|
130
+
|**Filter IPv4 (A records)**| Blocks IPv4 lookups. Only available in dual-stack mode.|
131
+
|**Filter IPv6 (AAAA records)**| Blocks IPv6 lookups. Only available in dual-stack mode.|
132
+
|**No filtering**| Returns both A and AAAA records. |
102
133
103
134
> [!IMPORTANT]
104
135
>
105
136
> Switching the default networking mode resets the DNS filter to Auto.
106
137
107
-
### Using Settings Management
108
-
109
-
If you're an administrator, you can use [Settings Management](/manuals/enterprise/security/hardened-desktop/settings-management/configure-json-file.md#networking) to enforce this Docker Desktop setting across your developer's machines. Choose from the following code snippets and at it to your `admin-settings.json` file,
110
-
or configure this setting using the [Admin Console](/manuals/enterprise/security/hardened-desktop/settings-management/configure-admin-console.md)
111
-
112
-
{{< tabs >}}
113
-
{{< tab name="Networking mode" >}}
114
-
115
-
Dual IPv4/IPv6:
116
-
117
-
```json
118
-
{
119
-
"defaultNetworkingMode": {
120
-
"locked": true
121
-
"value": "dual-stack"
122
-
}
123
-
}
124
-
```
125
-
126
-
IPv4 only:
127
-
128
-
```json
129
-
{
130
-
"defaultNetworkingMode": {
131
-
"locked": true
132
-
"value": "ipv4only"
133
-
}
134
-
}
135
-
```
136
-
137
-
IPv6 only:
138
-
139
-
```json
140
-
{
141
-
"defaultNetworkingMode": {
142
-
"locked": true
143
-
"value": "ipv6only"
144
-
}
145
-
}
146
-
```
147
-
148
-
{{< /tab >}}
149
-
{{< tab name="DNS resolution" >}}
150
-
151
-
Auto filter:
152
-
153
-
```json
154
-
{
155
-
"dnsInhibition": {
156
-
"locked": true
157
-
"value": "auto"
158
-
}
159
-
}
160
-
```
161
-
162
-
Filter IPv4:
163
-
164
-
```json
165
-
{
166
-
"dnsInhibition": {
167
-
"locked": true
168
-
"value": "ipv4"
169
-
}
170
-
}
171
-
```
172
-
173
-
Filter IPv6:
174
-
175
-
```json
176
-
{
177
-
"dnsInhibition": {
178
-
"locked": true
179
-
"value": "ipv6"
180
-
}
181
-
}
182
-
```
183
-
184
-
No filter:
185
-
186
-
```json
187
-
{
188
-
"dnsInhibition": {
189
-
"locked": true
190
-
"value": "none"
191
-
}
192
-
}
193
-
```
194
-
195
-
{{< /tab >}}
196
-
{{< /tabs >}}
197
-
198
-
## Networking features for Mac and Linux
138
+
## Network how-tos for Mac and Linux
199
139
200
140
### SSH agent forwarding
201
141
@@ -248,67 +188,3 @@ ping the Windows containers.
248
188
249
189
This is because the Docker `bridge` network is not reachable from the host.
250
190
However if you are a Windows user, per-container IP addressing is possible with Windows containers.
251
-
252
-
## Use cases and workarounds
253
-
254
-
### I want to connect from a container to a service on the host
255
-
256
-
The host has a changing IP address, or none if you have no network access.
257
-
Docker recommends you connect to the special DNS name `host.docker.internal`,
258
-
which resolves to the internal IP address used by the host.
259
-
260
-
You can also reach the gateway using `gateway.docker.internal`.
261
-
262
-
If you have installed Python on your machine, use the following instructions as an example to connect from a container to a service on the host:
263
-
264
-
1. Run the following command to start a simple HTTP server on port 8000.
265
-
266
-
`python -m http.server 8000`
267
-
268
-
If you have installed Python 2.x, run `python -m SimpleHTTPServer 8000`.
269
-
270
-
2. Now, run a container, install `curl`, and try to connect to the host using the following commands:
271
-
272
-
```console
273
-
$ docker run --rm -it alpine sh
274
-
# apk add curl
275
-
# curl http://host.docker.internal:8000
276
-
# exit
277
-
```
278
-
279
-
### I want to connect to a container from the host
280
-
281
-
Port forwarding works for `localhost`. `--publish`, `-p`, or `-P` all work.
282
-
Ports exposed from Linux are forwarded to the host.
283
-
284
-
Docker recommends you publish a port, or to connect from another
285
-
container. This is what you need to do even on Linux if the container is on an
286
-
overlay network, not a bridge network, as these are not routed.
287
-
288
-
For example, to run an `nginx` webserver:
289
-
290
-
```console
291
-
$ docker run -d -p 80:80 --name webserver nginx
292
-
```
293
-
294
-
To clarify the syntax, the following two commands both publish container's port `80` to host's port `8000`:
295
-
296
-
```console
297
-
$ docker run --publish 8000:80 --name webserver nginx
298
-
299
-
$ docker run -p 8000:80 --name webserver nginx
300
-
```
301
-
302
-
To publish all ports, use the `-P` flag. For example, the following command
303
-
starts a container (in detached mode) and the `-P` flag publishes all exposed ports of the
304
-
container to random ports on the host.
305
-
306
-
```console
307
-
$ docker run -d -P --name webserver nginx
308
-
```
309
-
310
-
Alternatively, you can also use [host networking](/manuals/engine/network/drivers/host.md#docker-desktop)
311
-
to give the container direct access to the network stack of the host.
312
-
313
-
See the [run command](/reference/cli/docker/container/run.md) for more details on
Copy file name to clipboardExpand all lines: content/manuals/desktop/settings-and-maintenance/settings.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -235,16 +235,18 @@ containers. Alternatively, you can opt not to share it by selecting **Cancel**.
235
235
236
236
### Proxies
237
237
238
-
Docker Desktop supports the use of HTTP/HTTPS and [SOCKS5 proxies](/manuals/desktop/features/networking.md#socks5-proxy-support).
238
+
Docker Desktop supports the use of HTTP/HTTPS and SOCKS5 proxies (Requires a business subscription).
239
239
240
-
HTTP/HTTPS proxies can be used when:
240
+
HTTP/HTTPS and SOCKS5 proxies can be used when:
241
241
242
242
- Signing in to Docker
243
243
- Pulling or pushing images
244
244
- Fetching artifacts during image builds
245
245
- Containers interact with the external network
246
246
- Scanning images
247
247
248
+
For more details on how it works, see [Using Docker Desktop with a proxy](/manuals/desktop/features/networking/index.md#useing-docker-desktop-with-a-proxy).
249
+
248
250
If the host uses a HTTP/HTTPS proxy configuration (static or via Proxy Auto-Configuration (PAC)), Docker Desktop reads
249
251
this configuration
250
252
and automatically uses these settings for signing in to Docker, for pulling and pushing images, and for
Copy file name to clipboardExpand all lines: content/manuals/desktop/troubleshoot-and-support/faqs/general.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ The host has a changing IP address, or none if you have no network access.
60
60
It is recommend that you connect to the special DNS name `host.docker.internal`,
61
61
which resolves to the internal IP address used by the host.
62
62
63
-
For more information and examples, see [how to connect from a container to a service on the host](/manuals/desktop/features/networking.md#i-want-to-connect-from-a-container-to-a-service-on-the-host).
63
+
For more information and examples, see [how to connect from a container to a service on the host](/manuals/desktop/features/networking.md#connect-a-container-to-a-service-on-the-host).
64
64
65
65
### Can I pass through a USB device to a container?
0 commit comments