Apple `container` 써보기
애플 공식 오픈소스 — Mac(Apple Silicon)에서 Linux 컨테이너를 경량 VM으로 실행 — Docker Desktop 대안 검토.
아직 만들지 않았습니다
이 페이지는 카드에 적힌 내용을 펼쳐 보여줄 뿐입니다 — 돌아가는 코드도, 열어볼 데모도 아직 없습니다. 무엇을 왜 만들려는지가 아래에 있습니다.
어떻게 보나
아직 범위 미정. github.com/apple/container
기술 노트
각 항목이 실제로 무엇을 보여주고 어떻게 동작하는지 — 위 카드보다 자세한 기술 설명입니다.
Apple `container` 써보기준비 중
목적: Docker Desktop 대안 검토 — 2대 PC·자정 자동작업의 로컬 인프라 후보.
동작 방식: 애플 공식 오픈소스 — Mac(Apple Silicon)에서 Linux 컨테이너를 경량 VM으로 실행. Swift 제작 · OCI 호환(Docker 이미지 그대로 pull/push) · 1.0.0 릴리스 · macOS 26 필요.
관련 코드:
"""Apple `container`: parse an OCI image reference and mock a pull + run,
illustrating the "container run <image>" mental model (no real container ops).
"""
from dataclasses import dataclass
@dataclass
class ImageRef:
name: str
tag: str
@classmethod
def parse(cls, ref):
if ":" in ref:
name, tag = ref.rsplit(":", 1)
else:
name, tag = ref, "latest"
return cls(name=name, tag=tag)
def __str__(self):
return f"{self.name}:{self.tag}"
def pull(image: ImageRef):
print(f"$ container pull {image}")
print(f" -> resolving OCI manifest for {image.name}, tag={image.tag}")
print(f" -> layers fetched (mocked), image ready as lightweight VM image")
def run(image: ImageRef, command):
print(f"$ container run {image} {' '.join(command)}")
print(f" -> booting lightweight Linux VM on Apple Silicon (mocked)")
print(f" -> exec: {' '.join(command)}")
return {"exit_code": 0, "stdout": "hello from inside the container (mocked)"}
for ref in ["nginx:1.27", "alpine"]:
image = ImageRef.parse(ref)
pull(image)
result = run(image, ["echo", "hello"])
print(f" exit_code={result['exit_code']} stdout={result['stdout']!r}\n")