Fix Podman mount on macOS by adding host.containers.internal support#22451
Conversation
|
Hi @Abhigyan-Shekhar. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
31220b3 to
f948afa
Compare
|
Can one of the admins verify this patch? |
f948afa to
8e8bfbd
Compare
| return nil, fmt.Errorf("RoutableHostIPFromInside is currently only implemented for linux") | ||
| // Podman on macOS runs inside a VM; host.containers.internal | ||
| // is the supported DNS entry for host access (similar to host.docker.internal for Docker) | ||
| if runtime.GOOS == "darwin" { |
There was a problem hiding this comment.
@Abhigyan-Shekhar does this work only of a specific verison of docker or mac? or all versions ? do we need to add a check ?
There was a problem hiding this comment.
This mirrors the existing Docker behavior in this file. The Docker driver uses host.docker.internal on both macOS and Windows without any explicit Docker or OS version checks (see lines 64–79). I followed the same pattern here for Podman on macOS, where host.containers.internal is documented as the standard DNS entry provided by Podman Machine / Podman Desktop for host access.
I didn’t add a version check because Docker doesn’t do so for the equivalent behavior, and I’m not aware of Podman Machine versions on macOS where host.containers.internal is conditionally unavailable once the VM is running.
At the moment this is scoped to macOS only. While Podman on Windows also runs inside a VM, I haven’t been able to verify host.containers.internal there end-to-end, so I avoided claiming Windows support without testing. I am happy to extend this to Windows as well if maintainers prefer matching Docker’s behavior.
There was a problem hiding this comment.
I meant do you know if this is different in macoos 13 or 15 or intel or macos 26 ? which macos did you try it on
There was a problem hiding this comment.
I tested on macOS 26.2 / Apple Silicon with Podman 5.7.1 and it works correctly. I’m not aware of behavioral differences across recent macOS versions or between Intel vs Apple Silicon for Podman Machine.
I am also attaching a screenshot showing a successful podman run alpine ping host.containers.internal run for reference.
There was a problem hiding this comment.
Pull request overview
This PR fixes the minikube mount failure on macOS when using the Podman driver by adding support for DNS resolution via host.containers.internal.
Changes:
- Added darwin-specific (macOS) handling in
RoutableHostIPFromInsidefunction for Podman - Utilizes
host.containers.internalDNS entry (Podman's equivalent to Docker'shost.docker.internal) - Improved error message to include the unsupported platform name
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Podman on macOS runs inside a VM; host.containers.internal | ||
| // is the supported DNS entry for host access (similar to host.docker.internal for Docker) | ||
| if runtime.GOOS == "darwin" { |
There was a problem hiding this comment.
The Docker driver at line 78 uses host.docker.internal for both Windows and macOS without a separate check for darwin. Consider whether Podman on Windows should also be supported using host.containers.internal, similar to how Docker handles both platforms with the same DNS approach. If Windows support for Podman is intended, the condition should be runtime.GOOS == "darwin" || runtime.GOOS == "windows" to match Docker's behavior.
| // Podman on macOS runs inside a VM; host.containers.internal | |
| // is the supported DNS entry for host access (similar to host.docker.internal for Docker) | |
| if runtime.GOOS == "darwin" { | |
| // Podman on macOS and Windows can run inside a VM; host.containers.internal | |
| // is the supported DNS entry for host access (similar to host.docker.internal for Docker) | |
| if runtime.GOOS == "darwin" || runtime.GOOS == "windows" { |
There was a problem hiding this comment.
I intentionally scoped this change to macOS (darwin) only. While Podman on Windows also runs inside a VM (WSL2 / Podman Desktop), I don't currently have a Windows environment to verify that host.containers.internal works reliably there for this use case. I wanted to avoid claiming Windows support without being able to test it end-to-end.
If Podman on Windows consistently provides host.containers.internal, I'm happy to extend this to windows as well (similar to Docker's handling). Otherwise, I think keeping this macOS-only is the safer approach for now.
There was a problem hiding this comment.
@mloskot can you Verify this if host.containers.internal work on windows ?
There was a problem hiding this comment.
@medyagh On Windows 11 Pro, I've got fresh install (it's me first time using podman on Windows) of the latest podman 5.7.1 configured with the default machine provider i.e. WSL2 and as far as I can tell the host.*.internal addressing is provisioned and works:
I hope that will do as the verification you asked for. Please, let me know if you want me to check anything else.
There was a problem hiding this comment.
@Abhigyan-Shekhar please add the windows as well since @mloskot verified it
The minikube mount command fails on macOS when using Podman as the driver because RoutableHostIPFromInside only supported Linux. This adds macOS support for Podman by using DNS resolution with host.containers.internal, following the same pattern as Docker's macOS implementation which uses host.docker.internal. Changes: - Add darwin-specific handling in RoutableHostIPFromInside - Use digDNS with host.containers.internal for Podman on macOS - Improve error message for unsupported platforms The implementation mirrors Docker's approach and leverages Podman's built-in DNS resolution for host connectivity on macOS where Podman runs inside a VM (Podman Machine).
8e8bfbd to
31c6235
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Abhigyan-Shekhar, mloskot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What this PR does / why we need it
Fixes
minikube mountfailure on macOS when using Podman driver by adding DNS resolution support viahost.containers.internal.Which issue(s) this PR fixes
Fixes #22390
Before and After
Before:
❌ Exiting due to IF_HOST_IP: RoutableHostIPFromInside is currently only implemented for linux
After:
📁 Mounting host path ./:/app ... 🎉 Successfully mounted ./:/app
Changes
host.containers.internalDNS (Podman's equivalent to Docker'shost.docker.internal)Testing