Skip to content

Fix Podman mount on macOS by adding host.containers.internal support#22451

Merged
medyagh merged 1 commit into
kubernetes:masterfrom
Abhigyan-Shekhar:fix-podman-macos-mount
Jan 23, 2026
Merged

Fix Podman mount on macOS by adding host.containers.internal support#22451
medyagh merged 1 commit into
kubernetes:masterfrom
Abhigyan-Shekhar:fix-podman-macos-mount

Conversation

@Abhigyan-Shekhar

@Abhigyan-Shekhar Abhigyan-Shekhar commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

Fixes minikube mount failure on macOS when using Podman driver by adding DNS resolution support via host.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

  • Added darwin-specific handling in RoutableHostIPFromInside
  • Uses host.containers.internal DNS (Podman's equivalent to Docker's host.docker.internal)
  • Improved error message for unsupported platforms

Testing

  • ✅ Build passes
  • ✅ Unit tests pass
  • ✅ Linter clean

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 14, 2026
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 14, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 14, 2026
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 14, 2026
@minikube-bot

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

Comment thread pkg/drivers/kic/oci/network.go Outdated
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" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Abhigyan-Shekhar does this work only of a specific verison of docker or mac? or all versions ? do we need to add a check ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 RoutableHostIPFromInside function for Podman
  • Utilizes host.containers.internal DNS entry (Podman's equivalent to Docker's host.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.

Comment thread pkg/drivers/kic/oci/network.go Outdated
Comment on lines +84 to +86
// 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" {

Copilot AI Jan 14, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
// 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" {

Copilot uses AI. Check for mistakes.

@Abhigyan-Shekhar Abhigyan-Shekhar Jan 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mloskot can you Verify this if host.containers.internal work on windows ?

@mloskot mloskot Jan 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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:

image

I hope that will do as the verification you asked for. Please, let me know if you want me to check anything else.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@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).
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Abhigyan-Shekhar, mloskot
Once this PR has been reviewed and has the lgtm label, please assign medyagh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@medyagh medyagh merged commit 9e4e74a into kubernetes:master Jan 23, 2026
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't minikube mount a folder to a VM on macos using podman as a driver

6 participants