-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Engdocs 2038 #19698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Engdocs 2038 #19698
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
content/desktop/hardened-desktop/settings-management/air-gapped-containers.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
description: Learn how to create air-gapped containers with Settings Management | ||
title: Configure air-gapped containers with Settings Management | ||
keywords: settings management, air gapped, security, Docker Desktop, configuration, proxy, network | ||
--- | ||
|
||
> **Beta feature** | ||
> | ||
> This feature is in [Beta](../../../release-lifecycle.md/#beta). | ||
> It's available with Docker Desktop version 4.29 and later. | ||
{ .experimental } | ||
|
||
Air-gapped containers allows administrators to restrict containers from accessing network resources, limiting where data can be uploaded to or downloaded from. | ||
|
||
Docker Desktop can apply a custom set of proxy rules to network traffic from containers. The proxy can be configured to: | ||
|
||
- Allow network connections | ||
- Reject network connections | ||
- Tunnel through an HTTP or SOCKS proxy | ||
|
||
You can choose: | ||
|
||
- Which outgoing TCP ports the policy applies to. For example, only certain ports, `80`, `443` or all with `*`. | ||
- Whether to forward to a single HTTP or SOCKS proxy, or to have a policy per destination via a Proxy Auto-Configuration (PAC) file. | ||
|
||
## Configuration | ||
|
||
Assuming [enforced sign-in](../../../security/for-admins/configure-sign-in.md) and Settings Management are enabled, add the new proxy configuration to the `admin-settings.json` file. For example: | ||
|
||
```json | ||
{ | ||
"configurationFileVersion": 2, | ||
"containersProxy": { | ||
"locked": true, | ||
"mode": "manual", | ||
"http": "", | ||
"https": "", | ||
"exclude": "", | ||
"pac": "http://192.168.1.16:62039/proxy.pac", | ||
"transparentPorts": "*" | ||
} | ||
} | ||
``` | ||
|
||
The `containersProxy` setting describes the policy which is applied to traffic from containers. The valid fields are: | ||
|
||
- `locked`: If true, it is not possible for developers to override these settings. If false the settings are interpreted as default values which the developer can change. | ||
- `mode`: Same meaning as with the existing `proxy` setting. Possible values are `system` and `manual`. | ||
- `http`, `https`, `exclude`: Same meaning as with the `proxy` setting. Only takes effect if `mode` is set to `manual`. | ||
- `pac` : URL for a PAC file. Only takes effect if `mode` is `manual`, and is considered higher priority than `http`, `https`, `exclude`. | ||
- `transparentPorts`: A comma-separated list of ports (e.g. `"80,443,8080"`) or a wildcard (`*`) indicating which ports should be proxied. | ||
|
||
> **Important** | ||
> | ||
> Any existing `proxy` setting in the `admin-settings.json` file continues to apply to traffic from the app on the host. | ||
{ .important } | ||
|
||
## Example PAC file | ||
|
||
For general information about PAC files, see the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file). | ||
|
||
The following is an example PAC file: | ||
|
||
```javascript | ||
function FindProxyForURL(url, host) { | ||
if (localHostOrDomainIs(host, 'internal.corp')) { | ||
return "PROXY 10.0.0.1:3128"; | ||
} | ||
if (isInNet(host, "192.168.0.0", "255.255.255.0")) { | ||
return "DIRECT"; | ||
} | ||
return "PROXY reject.docker.internal:1234"; | ||
} | ||
``` | ||
|
||
The `url` parameter is either `http://host_or_ip:port` or `https://host_or_ip:port`. | ||
|
||
The hostname is normally available for outgoing requests on port `80` and `443`, but for other cases there is only an IP address. | ||
|
||
The `FindProxyForURL` can return the following values: | ||
|
||
- `PROXY host_or_ip:port`: Tunnels this request through the HTTP proxy `host_or_ip:port` | ||
- `SOCKS5 host_or_ip:port`: Tunnels this request through the SOCKS proxy `host_or_ip:port` | ||
- `DIRECT`: Allows this request to go direct, without a proxy | ||
- `PROXY reject.docker.internal:any_port`: Rejects this request | ||
|
||
In this particular example, HTTP and HTTPS requests for `internal.corp` are sent via the HTTP proxy `10.0.0.1:3128`. Requests to connect to IPs on the subnet `192.168.0.0/24` connect directly. All other requests are blocked. | ||
|
||
To restrict traffic connecting to ports on the developers local machine, [match the special hostname `host.docker.internal`](../../networking.md#i-want-to-connect-from-a-container-to-a-service-on-the-host). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields are not shown in the example above. I think it would be clearer if they were.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If added to the example above they would be
(although watch out for the lack of comma on the last entry)