-
Notifications
You must be signed in to change notification settings - Fork 17
fix: loosen checkDockerHost to accept any unix:// socket; fix misleading test name #1912
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
Changes from 5 commits
36c3292
e4fc1cf
16b1dbf
fd081f2
066be1c
fd78a46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -866,6 +866,49 @@ export function applyAgentTimeout( | |||||
| logger.info(`Agent timeout set to ${result.minutes} minutes`); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Checks whether DOCKER_HOST is set to an external daemon that is incompatible | ||||||
| * with AWF. | ||||||
| * | ||||||
| * AWF manages its own Docker network (`172.30.0.0/24`) and iptables rules that | ||||||
| * require direct access to the host's Docker socket. When DOCKER_HOST points | ||||||
| * at an external TCP daemon (e.g. a DinD sidecar), Docker Compose routes all | ||||||
| * container creation through that daemon's network namespace, which breaks: | ||||||
| * - AWF's fixed subnet routing | ||||||
| * - The iptables DNAT rules set up by awf-iptables-init | ||||||
| * - Port-binding expectations between containers | ||||||
| * | ||||||
| * Any `unix://` socket (including non-default paths) is accepted because it | ||||||
| * still refers to a local Docker daemon. Only remote schemes (`tcp://`, | ||||||
| * `ssh://`, etc.) are rejected. | ||||||
| * | ||||||
| * @param env - Environment variables to inspect (defaults to process.env) | ||||||
| * @returns `{ valid: true }` when DOCKER_HOST is absent or uses a unix socket; | ||||||
| * `{ valid: false, error: string }` for remote daemon schemes. | ||||||
| */ | ||||||
| export function checkDockerHost( | ||||||
| env: Record<string, string | undefined> = process.env | ||||||
| ): { valid: true } | { valid: false; error: string } { | ||||||
| const dockerHost = env['DOCKER_HOST']; | ||||||
|
|
||||||
| if (!dockerHost) { | ||||||
| return { valid: true }; | ||||||
| } | ||||||
|
|
||||||
| if (dockerHost.startsWith('unix://')) { | ||||||
| return { valid: true }; | ||||||
| } | ||||||
|
|
||||||
| return { | ||||||
| valid: false, | ||||||
| error: | ||||||
| `DOCKER_HOST is set to an external daemon (${dockerHost}). ` + | ||||||
| 'AWF requires the local Docker daemon (default socket). ' + | ||||||
|
||||||
| 'AWF requires the local Docker daemon (default socket). ' + | |
| 'AWF requires a local Docker unix socket. ' + |
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.
This documentation example repeats “local Docker daemon (default socket)”, but the new behavior accepts non-default
unix://sockets too. Updating this wording to “local Docker daemon via a unix socket” (or similar) would keep the docs consistent with the relaxed check.