mirror of
https://github.com/apple/container.git
synced 2026-08-24 10:05:43 -05:00
Add container machine for managing persistent Linux VMs (#1662)
## Type of Change
- [ ] Bug fix
- [x] New feature
- [ ] Breaking change
- [ ] Documentation update
## Motivation and Context
`container` runs each workload in an ephemeral VM, so there's no
built-in way to keep a persistent Linux environment you can log into and
work in. `container machine` adds one.
A container machine is a lightweight, persistent, and integrated Linux
environments that feel like an extension of your Mac, created from
standard OCI images with a familiar UX. The login user matches your host
account with passwordless `sudo`, your home directory is mounted inside
the VM, and each machine keeps its filesystem and runs the image's own
init system (such as`systemd` or `openrc`).
```bash
container machine create alpine:3.22 --name my-machine
container machine run -n my-machine # interactive shell
container machine set -n my-machine cpus=4 memory=8G
```
Subcommands: `create`, `run`, `list` (`ls`), `inspect`, `set`,
`set-default`, `logs`, `stop`, `delete` (`rm`); `m` aliases `machine`.
Docs added to `docs/command-reference.md` (Machine Management) and
`docs/how-to.md` ("Use container machines").
## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
Signed-off-by: Raj Aryan Singh <rajaryan_singh@apple.com>
Co-authored-by: Jaewon Hur <jaewon_hur@apple.com>
Co-authored-by: John Logan <john_logan@apple.com>
Co-authored-by: Michael Crosby <michael_crosby@apple.com>
Co-authored-by: Eric Ernst <eric_ernst@apple.com>
Co-authored-by: Danny Canter <danny_canter@apple.com>
This commit is contained in:
co-authored by
Jaewon Hur
John Logan
Michael Crosby
Eric Ernst
Danny Canter
parent
1b5576312f
commit
b2994ac369
@@ -63,7 +63,7 @@ extension APIServer {
|
||||
var routes = [XPCRoute: XPCServer.RouteHandler]()
|
||||
let pluginLoader = try initializePluginLoader(log: log)
|
||||
|
||||
try await initializePlugins(pluginLoader: pluginLoader, log: log, routes: &routes)
|
||||
try await initializePlugins(pluginLoader: pluginLoader, log: log, routes: &routes, debug: debug)
|
||||
let containersService = try initializeContainersService(
|
||||
pluginLoader: pluginLoader,
|
||||
containerSystemConfig: containerSystemConfig,
|
||||
@@ -227,14 +227,15 @@ extension APIServer {
|
||||
private func initializePlugins(
|
||||
pluginLoader: PluginLoader,
|
||||
log: Logger,
|
||||
routes: inout [XPCRoute: XPCServer.RouteHandler]
|
||||
routes: inout [XPCRoute: XPCServer.RouteHandler],
|
||||
debug: Bool = false
|
||||
) async throws {
|
||||
log.info("initializing plugins")
|
||||
|
||||
let bootPlugins = pluginLoader.findPlugins().filter { $0.shouldBoot }
|
||||
|
||||
let service = PluginsService(pluginLoader: pluginLoader, log: log)
|
||||
try await service.loadAll(bootPlugins)
|
||||
try await service.loadAll(bootPlugins, debug: debug)
|
||||
|
||||
let harness = PluginsHarness(service: service, log: log)
|
||||
routes[XPCRoute.pluginGet] = XPCServer.route(harness.get)
|
||||
|
||||
Reference in New Issue
Block a user