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:
Aditya Ramani
2025-11-09 20:54:59 -08:00
committed by GitHub
parent 2c4c044060
commit 2e93381de3
3 changed files with 5 additions and 6 deletions
+1 -5
View File
@@ -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
+1
View File
@@ -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()
)