apple / apple/container

[Request]: Be able to use containers from LaunchDaemon-based CI runners

Open
#1,514 0 comments 0 reactions 1 assignee Claimed by @jglogan View on GitHub
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### Feature or enhancement request details

When you run `container system start`, it installs `container-apiserver` as a per-user LaunchAgent in `gui/`, with state under `~/Library/Application Support/com.apple.container/`. This is awkward for CI: GitHub's `actions/runner` and most macOS CI runners are designed to install as LaunchDaemons (no GUI session needed). A daemon-mode runner can't reach the apiserver's mach service in `gui/`, so steps that shell out to `container ...` fail.

If you install the CI runner itself as a LaunchAgent, then the processes it spawns end up in the user GUI session, where they become subject to macOS's Local Network Privacy checks. So if you start a container and it ends up with IP address 192.168.64.1, and your test code tries to access it, you can run into LNP issues and get "No route to host" errors.

Apple's support itself actually recommends [using a LaunchDaemon](https://developer.apple.com/forums/thread/770473) as a workaround for LNP issues.

So there are seemingly blockers for using containers in CI via either LaunchAgent or LaunchDaemon runners. In general I'd prefer to use LaunchDaemons since LaunchAgents are more cumbersome. Is there some way to work with containers from within a LaunchDaemon? If not, I'd like to request this functionality. Thanks!

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.