Skip to content

Give native Docker containers IPv4 internet access - #2

Merged
SeniorStackOverflow merged 1 commit into
mainfrom
feat/docker-internet
Oct 6, 2026
Merged

SeniorStackOverflow merged 1 commit into
mainfrom
feat/docker-internet

Conversation

@SeniorStackOverflow

Copy link
Copy Markdown
Owner

The native Docker launcher created a private network namespace with no uplink, so containers and the daemon could not reach the internet. It now connects that namespace to Android's IPv4 connection through a supervised veth uplink. Registry pulls, DNS, HTTP(S), and package downloads work on default and user-created Docker bridges.

The supervisor follows Android root's selected internet routing table, blocks egress when no route is available, and restores connectivity when it returns. Its forwarding request is managed by netd; firewall and policy changes are scoped to the Docker uplink and removed after daemon exit or explicit stop. The daemon trusts Android's system CA directories. The original offline mode remains available with --isolated.

Validated on SM-A515F / A515FXXU5EUJ4 with SELinux Enforcing:

  • A real alpine:3.22 download from Docker Hub on the handset.
  • External DNS, IPv4 HTTP, certificate-verified HTTPS, rejection of an untrusted certificate, and apk update on both bridge types.
  • Container-name DNS and bridge round trip; an internal bridge remains offline.
  • Daemon restart, automatic recovery after route loss, duplicate-start rejection, supervisor-kill recovery, and automatic/explicit cleanup. Android firewall rules, policy rules, and forwarding state matched their baseline after cleanup.
  • KVM: 12 guest cycles across all eight CPUs, held-vCPU idle/migration, and virtual timers on CPU0/CPU4.
  • make check, ShellCheck, Python compilation, and git diff --check.

Sanitized results are in evidence/docker-internet-summary.json; reproduction instructions and the internet validator are included. Wi-Fi was measured. This uplink does not add container IPv6, LAN ingress, per-app VPN policy, or an autostart service.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T09:26:12.015256Z 83f82e5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SeniorStackOverflow
SeniorStackOverflow merged commit b7cc744 into main Oct 6, 2026
4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83f82e5703

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"ping -c 1 -W 5 a51-internet-peer; "
"echo 'PASS container-name DNS and bridge round trip'; " + script)
finally:
docker('rm', '-f', 'a51-internet-peer')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid deleting a pre-existing peer container

If a container named a51-internet-peer already exists while the test network does not, the docker run --name call fails with a name conflict, but this unconditional cleanup then forcibly removes that pre-existing container. Check for the container before starting or track whether this invocation successfully created it before deleting it.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant