Skip to content

Instantly share code, notes, and snippets.

@YOU54F
Last active September 20, 2023 08:53
Show Gist options
  • Save YOU54F/6e70e0893b589a3c6506a2f1abbc850d to your computer and use it in GitHub Desktop.
Save YOU54F/6e70e0893b589a3c6506a2f1abbc850d to your computer and use it in GitHub Desktop.
MacOS Apple Silicon - OCI Darwin containers on & All things virtual machines

Containers have fundamentally changed the way that modern software is developed and deployed. Containers are supported by a wide range of operating systems including FreeBSD, Solaris, Linux and even Windows, but are not natively supported by macOS. Until now.

Quote from https://github.com/macOScontainers

Reference list:- https://github.com/stars/YOU54F/lists/apple-virtualization

NB - This list in mainly for Apple Sili

Darwin Containers

The open source developer community is working together to implement support for native containers on macOS. The first step is to add low-level components in containerd, the underlying runtime used by both Docker and Kubernetes. This foundational work will pave the way for adoption of macOS containers throughout the container tooling ecosystem. You can help by upvoting or commenting on the feature proposal:

Steps

  1. Booting containerd

image

  1. Downloading image

image

  1. Running image

image

Linux Containers

Projects providing linux runtimes.

Krunvm

Isle

Virt

Virtual MacOS

Various tooling for Virtual Machines based on macOS

Essential Posts

From co-founder of legendary https://dortania.github.io/

Mixed VM tooling - Supporting MacOS/Linux/Windows

Various tooling for Virtual Machines which support running multiple operating systems on macOS

all: build_rund build_ctr build_containerd build_buildctl build_buildkitd
build_rund:
cd rund && \
go build -o ../bin/ cmd/containerd-shim-rund-v1.go
build_ctr:
cd containerd && \
go build -o ../bin/ctr cmd/ctr/main.go
build_containerd:
cd containerd && \
go build -o ../bin/containerd cmd/containerd/main.go
build_buildkitd:
cd buildkit && \
go build -o ../bin/ ./cmd/buildkitd
build_buildctl:
cd buildkit && \
go build -o ../bin/ ./cmd/buildctl
setup_buildkit_config:
sudo mkdir -p /etc/buildkit/
sudo echo '[worker.containerd]' >> /etc/buildkit/buildkitd.toml
sudo echo 'runtime = "${PWD}/bin/containerd-shim-rund-v1"' >> /etc/buildkit/buildkitd.toml
start_all:
make start_containerd &
make start_buildkitd &
kill_all:
sudo killall containerd
sudo killall buildkitd
start_containerd:
sudo bin/containerd
start_buildkitd:
sudo bin/buildkitd
pull_ventura:
sudo bin/ctr image pull ghcr.io/macoscontainers/macos-jail/ventura:latest
pull_monterey:
sudo bin/ctr image pull ghcr.io/macoscontainers/macos-jail/monterey:latest
pull_bigsur:
sudo bin/ctr image pull ghcr.io/macoscontainers/macos-jail/bigsur:latest
ls:
sudo bin/ctr image ls
shell_ventura:
@IMAGE=ventura make shell
shell_monterey:
@IMAGE=monterey make shell
shell_bigsur:
@IMAGE=bigsur make shell
shell_hello_ventura:
@IMAGE=ventura make shell_hello
shell_hello_monterey:
@IMAGE=monterey make shell_hello
shell_hello_bigsur:
@IMAGE=bigsur make shell_hello
shell: # containers should be removed by runtime, so the 2nd step should be able to be removed in future
@sudo bin/ctr run --rm -t --runtime ${PWD}/bin/containerd-shim-rund-v1 ghcr.io/macoscontainers/macos-jail/$(IMAGE):latest $(IMAGE) /bin/sh || make container_remove && \
make container_remove
shell_hello: # containers should be removed by runtime, so the 2nd step should be able to be removed in future
@sudo bin/ctr run --rm -t --runtime ${PWD}/bin/containerd-shim-rund-v1 ghcr.io/macoscontainers/macos-jail/$(IMAGE):latest $(IMAGE) /bin/sh -c 'echo "Hello from macOS container" && uname -a && echo $$PATH && printenv' || make container_remove && \
make container_remove
container_remove:
@sudo rm -rf /var/run/containerd/io.containerd.runtime.v2.task/default/$(IMAGE)
dockerfile_create:
echo 'FROM ghcr.io/macoscontainers/macos-jail/ventura:latest' >> Dockerfile
echo 'RUN echo "Hello, World!"' >> Dockerfile
dockerfile_build:
sudo bin/buildctl build --frontend=dockerfile.v0 --local context=. -local dockerfile=. --output type=image,name=docker.io/you54f/ventura:latest
.PHONY: containerd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment