mirror of
https://github.com/apple/container.git
synced 2026-09-27 01:55:43 +00:00
Pull initfs from repository when running ctr-example (#391)
Use the initial filesystem image from a remote repository when brining up the ctr-example
This commit is contained in:
@@ -18,7 +18,7 @@ SWIFT = /usr/bin/swift
|
||||
|
||||
.PHONY: all build clean run
|
||||
|
||||
all: containerization run
|
||||
all: run
|
||||
|
||||
build:
|
||||
$(SWIFT) build --configuration release
|
||||
@@ -39,10 +39,6 @@ debug:
|
||||
|
||||
fmt:
|
||||
$(SWIFT) format --in-place --recursive Sources/
|
||||
|
||||
containerization:
|
||||
$(MAKE) -C ../.. all
|
||||
|
||||
fetch-default-kernel:
|
||||
$(MAKE) -C ../.. fetch-default-kernel
|
||||
cp -L ../../.local/vmlinux ./vmlinux
|
||||
|
||||
@@ -24,6 +24,7 @@ After the build completes, the example will run. In your terminal you should see
|
||||
|
||||
```
|
||||
Starting container example...
|
||||
Fetching container initial filesystem...
|
||||
Creating container from docker.io/library/alpine:3.16...
|
||||
Starting container...
|
||||
/ #
|
||||
|
||||
@@ -28,10 +28,12 @@ struct CtrExample {
|
||||
try current.setraw()
|
||||
defer { current.tryReset() }
|
||||
|
||||
let initfsReference = "ghcr.io/apple/containerization/vminit:0.13.0"
|
||||
print("Fetching base container filesystem...")
|
||||
// Create container manager with file-based initfs
|
||||
var manager = try await ContainerManager(
|
||||
kernel: Kernel(path: URL(fileURLWithPath: "./vmlinux"), platform: .linuxArm),
|
||||
initfsReference: "vminit:latest",
|
||||
initfsReference: initfsReference,
|
||||
network: try ContainerManager.VmnetNetwork()
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user