Oxcart 下载
菜单

Mac 上的容器网络:端口、VPN、DNS、Little Snitch 与 TLS

在 Mac 上,容器运行在 Mac 网络之后的 Linux 环境中,因此端口、VPN、DNS 和防火墙的行为取决于容器应用如何转发流量。Oxcart 的每个出站连接都由 Mac 自身发起,因此你的 VPN、DNS 和 Little Snitch 规则同样适用于容器,并且可选用 TLS 1.3 加密 Mac 与引擎之间的通信。

更新于

Mac 上的容器网络如何工作

macOS 无法直接运行 Linux 容器,因此 Mac 上的每款容器应用都会在 Linux 环境中运行它们,并在 Linux 和 Mac 之间转发流量。需要关注三条路径:

  • 入站:Mac 上的已发布端口将连接转发到容器。
  • 出站:容器连接互联网、公司网络或 Mac 上的服务。
  • 名称:容器查询主机名。

这些路径一旦绕过 Mac 自身的网络,VPN 路由就不会生效,内部主机名无法解析,防火墙也看不到哪个应用正在通信。Oxcart 的设计避免了这些问题。

出站:VPN、DNS 和防火墙依然生效

Oxcart 将容器和构建步骤发出的 IPv4、IPv6 出站 TCP 流量重定向到 Mac,由 Mac 使用自身的套接字建立连接。Mac 的路由表决定连接的路径,包括 VPN 客户端安装的路由。Oxcart 不修改 Mac 路由、VPN 设置或防火墙偏好设置。

地址查询(A 和 AAAA)使用 macOS 系统解析器,包括 /etc/hosts 和 VPN 配置的解析器选择,因此容器中的公司主机名解析方式与浏览器相同。容器名称仍限定在各自的 Docker 网络内,DNS 同时支持 UDP 和 TCP。

Little Snitch、LuLu 与终端安全代理

网络过滤器通常会在询问用户时,将新程序的首次连接暂缓约两秒。Oxcart 不会等待:在主链路验证通过前,连接走备用路径;连接缓慢或失败时会自动切换到备用路径;连续三次失败则暂停主链路 30 秒,再次探测。只需在过滤器中批准 Oxcart 一次,之后就会按规则处理。

入站:发布端口

使用标准 Docker 语法发布端口:

# Mac loopback only (recommended for development)
docker run -d -p 127.0.0.1:8080:80 nginx

# Ephemeral host port, UDP
docker run -d -p 127.0.0.1::9000/udp my-udp-service

# IPv4 and IPv6 listeners on the Mac
docker run -d -p "[::]:8080:80" nginx

未指定地址的绑定会监听 Mac 的所有 IPv4 地址,因此同一网络上的其他机器可以访问,除非被 macOS 防火墙阻止。TCP 和 UDP 可以使用相同的主机端口号。容器停止时,会释放已发布的监听端口。

已发布的端口也会在引擎自身的 localhost 上响应,因此容器中运行的镜像仓库可以作为推送目标:

docker run -d -p 127.0.0.1:5000:5000 --name registry registry:2
docker tag my-app localhost:5000/my-app
docker push localhost:5000/my-app

Ports 视图:端口为什么没有响应

Oxcart 的 Ports 视图列出 Mac 上的所有监听端口和每个容器端口,按仓库、工作树和分支分组,让同一项目的两份检出副本不再混淆。每个绑定都会显示为就绪、等待中或错误,并注明原因:

  • 该地址已被 Mac 上的其他进程占用;
  • 容器内的服务器只监听 127.0.0.1;
  • 该端口尚无服务监听。

其他机器可以访问的端口会有标记。编码代理可以通过 Oxcart 的 MCP ports 工具看到相同信息;请参阅面向 AI 编码代理的 Docker。

从容器访问 Mac

host.docker.internal 可在容器和构建步骤中解析,并通过 TCP 访问绑定在 Mac 的 127.0.0.1 上的服务。让容器连接到 Mac 上原生运行的数据库或开发服务器:

docker run --rm curlimages/curl http://host.docker.internal:3000/health

请把这视为一条有意开放的访问通道:运行的任何容器都能通过它访问 Mac 回环地址上的服务。因此,运行不可信容器时,不要在 127.0.0.1 上留下无需身份验证的管理服务。

Mac 与引擎之间的加密链路

Mac 与 Linux 环境之间的流量经过一个虚拟网络,macOS 会将该网络与同一台 Mac 上的其他虚拟化软件共享。启用 TLS 后,Oxcart 使用 TLS 1.3(TLS_AES_128_GCM_SHA256)封装这条链路上已发布端口及出站 TCP 的通信,固定使用每次引擎启动时新生成的证书,并配有每次启动独立的 256 位持有者令牌。令牌无效时会关闭连接;在 TLS 开始前,Linux 环境会关闭并非来自 Mac 地址的连接。

这解决的威胁是:共享网络上的其他软件伪造地址,以读取或注入流量,或向容器建立新连接。客户机防火墙还会阻止这些软件访问未发布的容器端口和内部解析器。链路加密有开销,这是我们主动选择承担的成本。Docker API 本身从不经过网络:它使用私有 Unix 套接字;没有发布端口时,Oxcart 在 Mac 上不持有任何 TCP 或 UDP 套接字。

当前限制

  • 尚未实现主机网络模式(--network host)和 IPv6 容器网络;容器使用 IPv4 地址。
  • host.docker.internal 支持 TCP;尚未实现到主机网关的 UDP。
  • 发布的 TCP 和 UDP 端口不会保留客户端地址:容器看到的对端是 Linux 一侧。
  • 非地址类 DNS 记录(如 SRV 和 TXT)使用网络的 DHCP 解析器,而非 macOS 分流 DNS。

故障排查

Mac 上的容器网络问题及解决方法
现象可能原因解决方法
连接 localhost:PORT 被拒绝服务器在容器内监听 127.0.0.1改为监听 0.0.0.0;Ports 视图会指出此问题
"port is already allocated"另一个进程或容器占用了主机端口换一个主机端口;Ports 视图会显示占用者
容器内无法解析内部主机名名称仅存在于 VPN 的 DNS 中在 Mac 上连接 VPN;地址查询会使用 Mac 的解析器
容器无法访问 Mac 上的开发服务器在容器内使用了 localhost使用 host.docker.internal
首次拉取停顿几秒网络过滤器正在询问是否允许新连接批准 Oxcart 一次即可;在此期间连接使用备用路径
同事可以访问你的开发端口发布时未指定地址发布到 127.0.0.1

常见问题

Mac 上的 Docker 容器会使用我的 VPN 吗?

在 Oxcart 中会。容器的出站连接由 Mac 自身建立,因此 Mac 的路由、VPN、用于地址查询的分流 DNS 和按应用设置的防火墙都会生效。Oxcart 不修改 Mac 路由、VPN 设置或防火墙偏好设置。

如何从容器访问 Mac 上的服务?

使用 host.docker.internal。在 Oxcart 中,容器和构建步骤都能通过它以 TCP 访问绑定在 Mac 的 127.0.0.1 上的服务。--add-host mac:host-gateway 可为同一地址添加另一个名称。

为什么容器明明在运行,却无法访问它的端口?

通常是容器内的服务器监听了 127.0.0.1,发布端口无法访问该地址;请改为监听 0.0.0.0。其他原因包括主机端口已被占用,或尚无服务监听。Oxcart 的 Ports 视图会指出具体原因。

Oxcart 能与 Little Snitch 和 LuLu 配合使用吗?

可以。网络过滤器在询问用户时暂缓 Oxcart 的首次连接,Oxcart 会在链路验证通过前使用备用路径,因此不会中断工作,也不会等待你的回答。缓慢或失败的连接会自动切换到备用路径。

Mac 上的容器流量会加密吗?

启用可选的 TLS 后,Mac 与 Oxcart 引擎之间已发布端口及出站 TCP 的通信通过 TLS 1.3 传输,固定使用每次引擎启动时生成的证书,并配有每次启动独立的 256 位令牌。它可保护该链路,防止 Mac 共享网络上的其他虚拟化软件访问。发往互联网的流量由应用自身采用的方式保护,例如 HTTPS。

同一网络中的其他机器能看到我发布的端口吗?

未指定地址的发布端口会监听 Mac 的所有 IPv4 地址,因此除非 macOS 防火墙阻止,否则其他机器可以访问。发布到 127.0.0.1 可将访问限制在本机。Oxcart 会标记其他机器可以访问的端口。

Oxcart 支持容器的主机网络或 IPv6 吗?

不支持。尚未实现主机网络模式和 IPv6 容器网络。容器使用 IPv4 地址;仍可通过 "[::]:8080:80" 在 IPv6 上发布端口。

来源与方法

本文描述的网络行为于 2026 年 10 月 10 日在 Oxcart 上进行了测试,包括出站 TCP、DNS、发布端口、主机访问,以及 Mac 到容器链路上的 TLS。

在你自己的项目中试用 Oxcart

免费试用 60 天。之后购买一个许可证,终身包含所有更新,无需订阅。

配备 Apple silicon 的 Mac · Windows 11 (x64)

继续阅读

版本更新说明

Oxcart 26.11.6

最新版本

Containers see the changes you make to files on your Mac as they happen.

  • Edit a file in a shared folder on your Mac, and tools that watch it in a container, such as Vite, webpack and nodemon, reload right away. Polling is not needed.
  • When no containers are running and you haven't used Docker for two minutes, Oxcart gives the memory it was using back to macOS. The next docker command starts it again in under a second. This doesn't happen while Kubernetes is turned on.
  • You can bring your images, volumes and networks over from another Docker app. Choose Import from Another Runtime… in the More (…) menu on the Containers page, or run oxcart import. Containers themselves aren't copied: start them again with docker compose up -d or docker run, and they use the imported volumes and networks.
  • Bug fixes and optimizations.
  • Updated Linux and system components, with the latest security fixes. A Windows virtual machine that is suspended when you update starts fresh afterwards.

需要 macOS 26.0 或更高版本

Oxcart 26.11.5

You can now turn on GPU acceleration for a Windows 11 virtual machine you already have.

  • Open the virtual machine's settings and turn on GPU acceleration under Display. Oxcart restarts Windows once, and the Windows desktop and Direct3D 10 and 11 apps then render on your Mac's GPU.
  • Turning GPU acceleration off puts back the standard display driver, and suspending works again.

需要 macOS 26.0 或更高版本

Oxcart 26.11.4

Bug fixes and optimizations.

  • Virtual machines start again after updating Oxcart while it is open.

需要 macOS 26.0 或更高版本

Oxcart 26.11.3

Windows virtual machines can now use your Mac's GPU.

  • Turn on GPU acceleration when you create a Windows 11 virtual machine, on the first step of New Virtual Machine. The Windows desktop and Direct3D 10 and 11 apps then render on your Mac's GPU instead of its processor.
  • A virtual machine with GPU acceleration can't be suspended or snapshotted while it runs. Shut it down instead. Existing virtual machines are not changed.
  • GPU acceleration is new. After a lot of opening and closing windows, the Windows screen can go black for about a second while Oxcart frees graphics memory.
  • Updated Linux and system components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.11.2

Oxcart can now run Kubernetes for you.

  • Turn on Kubernetes in Settings › Resources to get a local single-node cluster that kubectl can use right away.
  • Services in the cluster are reachable from your Mac at 127.0.0.1, and images you build with Docker run in the cluster without pushing them to a registry.
  • Updated Linux and system components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.11.1

Bug fixes and optimizations.

  • A simpler toolbar in the VM window.
  • Updated Linux and system components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.11.0

Clearer Windows audio, a network that comes back, and a VM toolbar that stays out of your way.

  • Clear Windows audio. Choppy, garbled sound in Windows VMs is fixed.
  • Networking that recovers. Turn a Windows VM's network off and on again, and it reconnects without a restart.
  • A toolbar that stays out of the way. It no longer covers the top of your VM. Move the pointer to the top center and click the small tab when you want it.
  • Simpler Oxcart Tools for Windows. One CD now holds everything, and the installer handles the drivers and any restart for you.
  • A more dependable clipboard in Windows VMs.
  • A license agreement to accept the first time you open Oxcart on your Mac.
  • Updated Linux, container and Docker components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.10.0

Virtual machines are here. Windows 11, Linux and macOS run on your Mac, built into Oxcart beside your containers and covered by the license you already have.

  • Windows 11 in about 5 minutes, hands off. Choose your Windows 11 ARM installer and walk away: Oxcart installs Windows, its drivers and Oxcart Tools by itself, on a VM with real TPM 2.0 and Secure Boot. You bring the installer and the license.
  • Linux in under a minute. Ubuntu, Debian and Fedora start with your Mac username, your SSH key and passwordless sudo already set up; Fedora is ready in about 30 seconds. Every further VM from the same image starts from an instant copy that takes only the space it changes. Ubuntu Desktop, Fedora Workstation and any arm64 Linux installer work too.
  • macOS on macOS. Oxcart restores the newest macOS your Mac supports and, with Automatic setup, creates your account and installs Oxcart Tools.
  • Every VM is a real Mac app. Each one has its own window, Dock icon and ⌘-Tab entry, and keeps running after you quit Oxcart. The Retina display follows the window as you resize it or go full screen, ⌘C and ⌘V work in Linux and Windows, and text, images and files move between your Mac and the guest by copy, paste and drag.
  • Snapshots that capture the moment. Snapshot a running VM with its open apps and return to that exact moment later. Snapshots and clones take almost no space until the guest changes, and a restore lands whole even if your Mac loses power halfway.
  • Your Mac's folders, network and USB. Share Mac folders with any guest, reach your Mac by name and publish ports from the VM. Hand a USB device to Windows for flashers, programmers and dongles; development boards' serial ports show up in Windows under their own IDs.
  • First-class for coding agents. VMs join containers in Oxcart's MCP server with 22 tools of their own, so an agent you connect can create, start, snapshot and clone VMs, run commands and copy files in the guest, forward ports, connect USB devices and disk images, and read the screen and type in any guest, even one without Oxcart Tools, all within the permission level you set for each agent. The oxcart vm command covers every operation, with JSON output for scripts and CI.
  • Encrypted VMs, when you want them. Keep a VM's disks and secrets behind a password of your own, with AES-256 encryption built into Oxcart, so an encrypted disk flushes as fast as a plain one.
  • Disk space you can see. Choose where a VM lives, on your Mac or an external drive, and see what it takes now and what it can grow to against the space you have. Reclaim Space hands back what a guest frees right away, and Disk Usage shows each downloaded system so you can remove the ones you no longer need.
  • VMs that move with you. Each VM is a single item in Finder you can keep on any drive. Export it as one .oxvm file to another Mac, and bring over Linux and macOS VMs from another Mac virtualization app.
  • Ready when you are. Chosen VMs start when you log in, run headless with no window at all, and suspend when you close them, so you pick up exactly where you left off.
  • Oxcart Help. Help › Oxcart Help (⌘?) explains every setting, what it does and what changing it affects, with a ? beside each one. Coding agents read the same help through MCP.
  • More reliable published ports. A container connection that a service closes mid-transfer now ends cleanly instead of waiting.
  • New version numbers. Releases are now numbered by year and month, so this one is 26.10.0.

需要 macOS 26.0 或更高版本

Oxcart 0.1.8

Oxcart 现已支持 Windows,购买后可终身享有所有更新。

  • Oxcart 也能在 Windows 上运行。一份许可证最多可用于 5 台设备,Mac 与 Windows 可任意组合。
  • 终身包含每次更新。
  • 截至 2026 年 12 月 31 日,Oxcart 售价为 $5。
  • 编程智能体可以检查容器、读取实时统计数据和资源压力、跟踪日志、追踪耗时较长的镜像拉取和构建,并按你设置的限制运行容器。
  • 重新创建容器时会保留其卷和网络别名。
  • Oxcart 的辅助程序在“登录项”中显示为 Oxcart。
  • 全面提升可靠性。

需要 macOS 26.0 或更高版本

Oxcart 0.1.7

更快的共享文件夹、更快的网络,以及可编辑的容器环境。

  • 共享文件夹大幅提速。在共享文件夹中克隆仓库、安装软件包和构建,速度最高可达原来的 3×。
  • 网络更快。发布端口和容器连接可传输近两倍的数据,同时减少 CPU 占用。
  • 按需启用加密。Mac 与容器之间的流量加密是可选的:可在 Settings › Resources › Encrypt container connections 中开启。
  • 环境变量更易查看和修改。在容器的 Overview 中查看变量,通过 Edit and Recreate 修改变量,还能一次粘贴整个 .env 文件。
  • Run Container 面板操作更顺畅。按 Return 会移至下一行,不会启动容器。
  • 故障排查更清晰。当 VPN 或防火墙拖慢连接时,Oxcart 会告知你。
  • 共享文件夹更可靠,能正确报告权限错误,并在 Mac 上的文件发生变更后及时更新内容。

需要 macOS 26.0 或更高版本

Oxcart 0.1.6

编程智能体可以修复所发现的问题,另有全面的问题修复与安全加固。

  • 新添加的智能体可以使用 Mac 上已有的镜像来启动、停止和重启容器,在容器内运行命令,以及启动 Compose 项目。拉取、构建和删除需要 Full 权限,可在 MCP Integrations 中为每个智能体分别设置。
  • 设置时会为每个智能体提供可直接使用的配置条目,运行 oxcart mcp check 可确认其是否正常工作。
  • 回答更准确:智能体能识别服务是否因其依赖的服务停机而停机、网页是否确实能加载,以及故障的原因和修复方法。
  • Start at login 会在登录时将 Oxcart 启动到菜单栏,随时可用。
  • Oxcart 启动时会检查更新,并向 oxcart.cc 发送一条简短的联络请求。Settings › Privacy 中会完整显示其中包含的内容。
  • 容器从启动之初就能发现所在网络中的其他服务。
  • 修复了特权容器、Rosetta 检查和设置过程中的安全防护问题。
  • Oxcart 应用会在执行任何删除数据或停止正在运行的任务的操作前征求确认。
  • 全面加强安全防护并提升可靠性。

需要 macOS 26.0 或更高版本

Oxcart 0.1.5

Oxcart 支持运行本地 Kubernetes 和特权容器,并提供十种语言。

  • 在 Settings › Resources › Kubernetes and networking 中开启特权容器,即可运行 kind、k3d、minikube(Docker 驱动)和 Docker-in-Docker,并使用 docker run --privileged 和 --device。此功能默认关闭。Oxcart 的防护机制会阻止每个容器访问 Oxcart 的磁盘、内核、其他容器的数据,以及 Oxcart 与 Mac 之间的通信通道。
  • 支持 IPv6 容器网络,此功能也默认关闭,适用于使用 IPv6 创建的网络,例如 kind 的双栈网络。
  • Oxcart 已翻译为简体中文、日语、德语、法语、西班牙语、巴西葡萄牙语、韩语、俄语和土耳其语。Settings › General › Language 中的语言设置仅对 Oxcart 生效。

需要 macOS 26.0 或更高版本

Oxcart 0.1.4

许可证功能与细节改进。

  • 通过安全邮件链接激活许可证。
  • 在 Settings 中管理许可证和 Mac。
  • 离线验证许可证。
  • 性能提升、界面优化与问题修复。

需要 macOS 26.0 或更高版本

Oxcart 0.1.3

空闲时回收内存。

  • 没有容器运行时回收 VM 内存。
  • 保留容器、镜像、卷和网络。

需要 macOS 26.0 或更高版本

Oxcart 0.1.2

命令行工具集成。

  • 在 Oxcart 自带的 Docker 工具与已安装的 Docker 工具之间切换。
  • 界面优化。

需要 macOS 26.0 或更高版本

Oxcart 0.1.1

内置 Docker 工具与智能体控制。

  • 自带 Docker CLI 29.9、Compose 5.6 和 Buildx 0.38。
  • Docker 上下文集成与安全的钥匙串凭据存储。
  • MCP 智能体连接,支持为各智能体设置权限或阻止访问。

需要 macOS 26.0 或更高版本

Oxcart 0.1.0

适用于 Apple 芯片的 Docker 兼容容器。

  • 兼容 Docker CLI、Compose 和 Buildx。
  • 自带运行时组件,可离线设置。
  • 按项目和 Git 分支整理端口。
  • MCP 集成,默认仅允许只读访问。
  • 经过验证的自动更新。

需要 macOS 26.0 或更高版本