
Container Macos
- 1 installs
- 1 repo stars
- Updated June 17, 2026
- yixian-huang/agent-skills
Assists with Apple's native `container` CLI on macOS to build, run, debug, and publish Linux containers, including networking, local DNS, and Compose alternatives.
About
Guides use of Apple's macOS-native `container` CLI as the default Docker alternative, covering service start, build/run/exec, registry publish, and networking quirks. A developer uses it for containerized dev environments and local services on macOS without Docker Desktop.
- Core workflow from container system start through image push
- macOS-specific notes on private network, local DNS, and container-compose
Container Macos by the numbers
- 1 all-time installs (skills.sh)
- Ranked #1,173 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
- Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yixian-huang/agent-skills --skill container-macosAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 1 |
| Last updated | June 17, 2026 |
| Repository | yixian-huang/agent-skills ↗ |
What it does
Assists with Apple's native `container` CLI on macOS to build, run, debug, and publish Linux containers, including networking, local DNS, and Compose alternatives.
Files
Apple container for macOS
Apple's container is a macOS-native container platform that provides a Docker-like CLI for building, running, and publishing Linux containers. It uses a lightweight virtual machine and its own virtual network. The CLI is intentionally similar to Docker, but has macOS-specific setup and conventions.
Default preference on macOS
When the user is on macOS and asks for containerization, a containerized dev environment, or a local service without explicitly specifying Docker, prefer Apple's `container` CLI. Only fall back to Docker if the user asks for Docker by name or if the ecosystem/project already depends on Docker Desktop-specific features.
container is the native, lightweight choice on macOS: no separate VM management app, built-in local DNS, and a Docker-compatible mental model.
Core workflow
1. Ensure the service is running
Most container failures happen because the background service is not running or the Linux kernel is not installed.
container system statusIf the status is not running, start the service. On first run this also installs the default kernel:
container system start --enable-kernel-installStop the service when finished:
container system stop2. Build an image
container build accepts a Dockerfile and build context, just like Docker:
container build --tag my-app --file Dockerfile .List built images:
container image list3. Run a container
Run in the background with auto-removal:
container run --name my-app --detach --rm my-appShow running containers and their IPs:
container lsThe container attaches to a private virtual network and receives an IP such as 192.168.64.3/24. Use this IP to reach the container from the host.
4. Execute commands and inspect
Run a one-off command:
container exec my-app ls /appOpen an interactive shell:
container exec -ti my-app shView resource usage:
container stats --no-stream my-app5. Publish an image
Log in to a registry, tag the image with the registry prefix, then push:
container registry login my-registry.example.com
container image tag my-app my-registry.example.com/user/my-app:latest
container image push my-registry.example.com/user/my-app:latestDefault registry is Docker Hub. Change it in ~/.config/container/config.toml:
[registry]
domain = "my-registry.example.com"6. Run multi-container apps with Container-Compose (optional)
Apple's container CLI does not include native multi-container orchestration or Compose file support. Container-Compose is a third-party tool that brings a Docker-Compose-like workflow to Apple Container for local multi-service apps.
Install via Homebrew:
brew update
brew install container-composeStart services defined in a Compose file:
container-compose upStop and remove them:
container-compose downYou can point to a specific Compose or environment file:
container-compose up -f /path/to/docker-compose.yml -e /path/to/.envWhen to use it
- Use
containerdirectly for one-off containers, image builds, and simple commands. - Use
container-composewhen you have multiple services, dependencies, volumes, or
environment variables declared in a Compose file and want a single command to start the whole stack on macOS without Docker Desktop.
Limitations
- This is a community project with limited Docker Compose compatibility; not every
Compose directive is supported.
- Local DNS auto-configuration works best on macOS 26 (Tahoe). On macOS 15 (Sequoia),
DNS may not be configured automatically, so services may need to reach each other by container IP.
- For complex production Compose files or unsupported features, fall back to Docker
Compose or run the services directly with container.
macOS-specific notes
Local DNS domain (optional)
container includes an embedded DNS server. Configure a local domain so containers are reachable by name from the host:
sudo container system dns create testAfterwards, a container named my-app resolves as my-app.test. Customize the domain in ~/.config/container/config.toml.
Configuration file
Global config lives at ~/.config/container/config.toml. Use it for:
- Default registry domain
- Local DNS domain
- Resource defaults
Networking
- Containers attach to a private virtual network (
192.168.64.0/24by default). - Bind services to
0.0.0.0inside the container so they accept connections from the host. - The host cannot reach container loopback (
127.0.0.1); use the container IP or DNS name. - Containers can reach each other by IP or by local DNS name if configured.
References
- [references/commands.md](references/commands.md): concise command reference and common flags.
- [references/troubleshooting.md](references/troubleshooting.md): common failures, diagnostic steps, and fixes.
Health check
Run the bundled script to verify the local container installation end-to-end:
bash <skill-path>/scripts/health-check.shThis checks CLI availability, service status, kernel configuration, and the ability to build/run a minimal container.
container Command Reference
Lifecycle
| Command | Description |
|---|---|
container system start | Start background services |
container system start --enable-kernel-install | Start and install the default kernel if missing |
container system stop | Stop background services |
container system status | Show service status |
| `container system version --format table\ | json` |
container system dns create <domain> | Create a local DNS domain (requires sudo) |
Containers
| Command | Description |
|---|---|
container run [opts] <image> | Create and start a container |
container create [opts] <image> | Create a container without starting |
container start <container> | Start an existing container |
container stop <container> | Stop a running container |
container kill <container> | Kill a running container |
container rm <container> | Delete a stopped container |
container ls / container list | List running containers |
container ls -a / container list --all | List all containers |
container exec [opts] <container> <command> | Run a command in a running container |
container logs <container> | Fetch container logs |
container inspect <container> | Show container metadata |
container stats [container] | Show live resource statistics |
container stats --no-stream [container] | Show one-shot statistics |
Common run flags
-d,--detach— run in background--rm— remove container after it stops--name <name>— assign a name-p,--publish— publish ports when supported-v,--volume— mount volumes when supported-e,--env— set environment variables-it— interactive TTY (for shells)
Common exec flags
-t,--tty— allocate a pseudo-TTY-i,--interactive— keep stdin open-ti/-it— combined shorthand for shell access
Images
| Command | Description |
|---|---|
container build --tag <name> --file Dockerfile . | Build an image from a Dockerfile |
container image list | List local images |
container image delete <image> | Delete an image |
container image tag <src> <target> | Tag an image |
container image push <image> | Push an image to a registry |
container image pull <image> | Pull an image from a registry |
Registry
| Command | Description |
|---|---|
container registry login <domain> | Authenticate to a registry |
container registry logout <domain> | Remove registry credentials |
container registry list | List configured registries |
Help
Append --help to any command or subcommand for detailed usage:
container --help
container run --help
container image --helpDocker to container command mapping
When converting Docker-based instructions or mental models to container:
| Docker command | container equivalent |
|---|---|
docker build -t <tag> . | container build --tag <tag> . |
docker run -d --rm --name <name> <image> | container run --name <name> --detach --rm <image> |
docker run -it --rm <image> sh | container run -it --rm <image> sh |
docker ps | container ls |
docker ps -a | container ls -a |
docker exec -it <container> sh | container exec -ti <container> sh |
docker exec <container> <cmd> | container exec <container> <cmd> |
docker logs <container> | container logs <container> |
docker inspect <container> | container inspect <container> |
docker stop <container> | container stop <container> |
docker rm <container> | container rm <container> |
docker images | container image list |
docker rmi <image> | container image delete <image> |
docker tag <src> <target> | container image tag <src> <target> |
docker push <image> | container image push <image> |
docker pull <image> | container image pull <image> |
docker login <registry> | container registry login <registry> |
docker system info | container system status |
Flags map closely: -d/--detach, --rm, --name, -it/-ti, -e, -v, -p. Always ensure container system start has been run before build/run operations.
Container-Compose command reference
Container-Compose is an optional, third-party tool that adds Compose-style orchestration to Apple Container. It does not ship with container; install it separately with brew install container-compose.
| Command | Description |
|---|---|
container-compose up | Create and start services from the Compose file |
container-compose down | Stop and remove services |
container-compose ps | List running services |
container-compose logs [service] | View service logs |
container-compose exec <service> <command> | Run a command in a running service container |
container-compose build [service] | Build images defined in the Compose file |
Common flags
-f,--file <path>— path to the Compose file (defaultdocker-compose.yml)-e,--env <path>— path to the environment file (default.env)-d,--detach— run services in the background when supported
Notes
- Container-Compose has limited Docker Compose compatibility; unsupported directives
may be ignored or cause errors.
- Service DNS names work best on macOS 26 (Tahoe). On macOS 15 (Sequoia), services may
need to communicate via container IPs.
- Ensure
container system starthas been run before usingcontainer-compose up.
container Troubleshooting Guide
Service will not start
Symptom: No default kernel configured
container system start prompts for kernel installation but hangs in non-interactive shells.
Fix:
container system start --enable-kernel-installThis installs the default Kata Containers kernel automatically.
Symptom: failed to read user input
The start command requires a TTY for the kernel install prompt.
Fix: use --enable-kernel-install or --disable-kernel-install to avoid the prompt.
Symptom: apiserver not responding
Check status:
container system statusRestart the service:
container system stop
container system start --enable-kernel-installContainer cannot be reached from host
1. Confirm the container IP:
container ls2. Inside the container, bind the service to 0.0.0.0, not 127.0.0.1. 3. From the host, use the container IP (e.g., http://192.168.64.3). 4. If a local DNS domain is configured, use <container-name>.<domain>.
DNS name does not resolve
1. Verify the domain was created:
sudo container system dns create test2. Check /etc/resolver/ contains a file for the domain. 3. Ensure the container name matches the hostname exactly. 4. DNS resolution may require a brief delay after container start.
Build fails or is slow
1. Confirm container system status shows running. 2. The first build pulls the base image and may be slow. 3. Ensure the build context (the . argument) contains the Dockerfile and needed files. 4. For network issues, verify registry access:
container image pull docker.io/hello-worldImage push fails
1. Log in first:
container registry login <registry-domain>2. Tag the image with the full registry path:
container image tag my-app <registry-domain>/<user>/<repo>:<tag>3. Check the default registry in ~/.config/container/config.toml if you expect Docker Hub.
General diagnostic checklist
1. which container — CLI installed? 2. container --version — which version? 3. container system status — service running? 4. container list --all — any stuck containers? 5. container image list — expected images present? 6. Run bash <skill-path>/scripts/health-check.sh for an end-to-end smoke test.
#!/usr/bin/env bash
set -euo pipefail
# Health check script for Apple's `container` CLI on macOS.
# Verifies CLI availability, service status, kernel configuration, and the
# ability to build and run a minimal container.
CONTAINER_BIN="${CONTAINER_BIN:-container}"
TEST_IMAGE="container-health-check"
TEST_CONTAINER="container-health-check-c"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"; container stop "$TEST_CONTAINER" >/dev/null 2>&1 || true' EXIT
info() { printf '\033[1;34m[INFO]\033[0m %s\n' "$*"; }
ok() { printf '\033[1;32m[OK]\033[0m %s\n' "$*"; }
warn() { printf '\033[1;33m[WARN]\033[0m %s\n' "$*"; }
fail() { printf '\033[1;31m[FAIL]\033[0m %s\n' "$*"; }
info "Checking container CLI..."
if ! command -v "$CONTAINER_BIN" >/dev/null 2>&1; then
fail "container CLI not found in PATH"
exit 1
fi
ok "container CLI found at $(command -v "$CONTAINER_BIN")"
"$CONTAINER_BIN" --version
echo
info "Checking container service status..."
if ! "$CONTAINER_BIN" system status >/dev/null 2>&1; then
warn "container service is not running; attempting to start..."
if ! "$CONTAINER_BIN" system start --enable-kernel-install; then
fail "failed to start container service"
exit 1
fi
fi
ok "container service is running"
echo
info "Listing existing containers..."
"$CONTAINER_BIN" list --all || true
echo
info "Building a minimal smoke-test image..."
cat > "$TMP_DIR/Dockerfile" <<'EOF'
FROM docker.io/python:alpine
WORKDIR /content
RUN echo '<h1>container health check OK</h1>' > index.html
CMD ["python3", "-m", "http.server", "80", "--bind", "0.0.0.0"]
EOF
if ! "$CONTAINER_BIN" build --tag "$TEST_IMAGE" --file "$TMP_DIR/Dockerfile" "$TMP_DIR"; then
fail "failed to build smoke-test image"
exit 1
fi
ok "smoke-test image built"
echo
info "Running smoke-test container..."
if ! "$CONTAINER_BIN" run --name "$TEST_CONTAINER" --detach --rm "$TEST_IMAGE"; then
fail "failed to run smoke-test container"
exit 1
fi
ok "smoke-test container running"
echo
info "Waiting for service to be ready..."
sleep 3
echo
info "Fetching container IP..."
IP="$("$CONTAINER_BIN" ls | awk -v c="$TEST_CONTAINER" '$1 == c {print $6}' | sed 's|/.*||')"
if [[ -z "$IP" ]]; then
fail "could not determine container IP"
exit 1
fi
ok "container IP is $IP"
echo
info "Testing HTTP endpoint..."
if curl -fsS "http://$IP/" >/dev/null 2>&1; then
ok "HTTP endpoint responds"
else
warn "HTTP endpoint did not respond immediately; retrying once..."
sleep 3
if curl -fsS "http://$IP/" >/dev/null 2>&1; then
ok "HTTP endpoint responds after retry"
else
fail "HTTP endpoint is not reachable at http://$IP/"
exit 1
fi
fi
echo
info "Testing container exec..."
if ! "$CONTAINER_BIN" exec "$TEST_CONTAINER" uname -a >/dev/null 2>&1; then
fail "container exec failed"
exit 1
fi
ok "container exec works"
echo
info "Testing container stats..."
"$CONTAINER_BIN" stats --no-stream "$TEST_CONTAINER" || true
echo
ok "All health checks passed. container is working correctly."