Documentation version: 2.4.14
Project release: v2.4.14
No daemon. No Docker. Just containers.
~5 MB static binary · zero daemon · OCI images · bridge networking · cluster · FaaS
🤝 Contributing · GitHub contributors · Apache-2.0 License
cardinal run --rm alpine echo "hello from cardinal!"
cardinal run -d -n web -p 8081:80 nginx:alpine
curl http://localhost:8081# Universal installer (Linux distributions) — downloads only from GitHub
curl -fsSL https://raw.githubusercontent.com/animesao/cardinal/main/install.sh | sudo bash
# Debian/Ubuntu APT repository installer (optional)
curl -fsSL https://raw.githubusercontent.com/animesao/cardinal/main/scripts/install-apt.sh | sudo bash
# Pull & run
cardinal pull nginx:alpine
cardinal run -d -n web -p 8081:80 nginx:alpine
# Check
cardinal ps
curl http://localhost:8081
# Logs & exec
cardinal logs web
cardinal exec web cat /etc/hostname
# Interactive
cardinal run -i -t alpine sh
# Stop & remove
cardinal stop web && cardinal rm webRequirements: Linux with unshare, nsenter, ip, iptables, mount, pgrep +
PID/Mount/Net/UTS/IPC namespaces + overlayfs.
Reserved host ports:
cardinal-wings(the panel agent) listens on127.0.0.1:8080by default andcardinal serveon2375, so the examples above map nginx to host port8081.cardinal runwarns when the requested host port is already bound on the host, and refuses a port already mapped by another container. Ifcurl http://localhost:8080returns{"error":"missing bearer token"}, you reached wings — not your container (check withss -tlnp | grep 8080and use another host port, e.g.-p 8081:80).
GitHub Releases provide native .deb, .rpm, .pkg.tar.zst, and .apk
packages for amd64, arm64, and armv6, .snap packages for amd64 and
arm64, plus self-contained AppImages for amd64 and arm64. AppImage needs
no package manager, but cardinal still requires the Linux kernel features listed
above. True ARMv6 hosts should use the raw cardinal-linux-armv6 binary or its
.tar.gz archive because the standard AppImage runtime does not support ARMv6.
On a Linux desktop, double-clicking the AppImage opens a terminal-based installer
that installs the embedded static binary to /usr/local/bin/cardinal and enables
the systemd supervisor when available. The original AppImage remains portable.
You can start the same installer explicitly with
TAG="$(curl -fsSL https://api.github.com/repos/animesao/cardinal/releases/latest | sed -n 's/.*"tag_name": "\([^"]*\)".*/\1/p')"
test -n "$TAG" || { echo "Could not determine the latest release" >&2; exit 1; }
FILE="cardinal-${TAG#v}-linux-amd64.AppImage"
curl -fL -o "$FILE" "https://github.com/animesao/cardinal/releases/download/$TAG/$FILE"
chmod +x "$FILE"
"./$FILE" --installThe AppImage remains a CLI runtime; pass a cardinal command such as version or
run for normal portable use. On a headless VPS, run the AppImage from SSH
instead of double-clicking it.
Вместо позиционных аргументов можно передать образ, команду и рабочую директорию через флаги. Это удобно для длинных команд и скриптов:
cardinal run -d \
--image ОБРАЗ \
--cmd "КОМАНДА" \
--workdir /path \
--restart always \
-n ИМЯ -p ПОРТ \
-v SRC:DST --memory 4G --cpus 4 \
--network host
Minecraft Paper:
cardinal run -d --restart always \
-n mc-paper -p 25565:25565 \
-v $PWD:/data --memory 4G --cpus 4 \
-workdir /data \
-image eclipse-temurin:21-jdk \
-cmd "java -Xmx3500M -jar paper-1.21.11-116.jar nogui"Discord-бот:
cardinal run -d --restart always \
-n discord-bot \
-v /data/bot:/bot --workdir /bot \
-e BOT_TOKEN=your_token \
-image python:3.12 \
-cmd "sh -c 'pip install -r /bot/requirements.txt && exec python /bot/bot.py'"Telegram-бот:
cardinal run -d --restart always \
-n tg-bot \
-v /data/tg-bot:/bot --workdir /bot \
-e BOT_TOKEN=your_token \
-image python:3.12 \
-cmd "sh -c 'pip install -r /bot/requirements.txt && exec python /bot/bot.py'"PostgreSQL:
cardinal run -d --restart always \
-n postgres -p 5432:5432 \
-v pg_data:/var/lib/postgresql/data \
-e POSTGRES_DB=myapp -e POSTGRES_PASSWORD=secret \
-image postgres:16Redis:
cardinal run -d --restart always \
-n redis -p 6379:6379 \
-v redis_data:/data \
-image redis:7 \
-cmd "redis-server --appendonly yes"Nginx (статический сайт):
cardinal run -d --restart always \
-n web -p 8081:80 \
-v /data/site:/usr/share/nginx/html \
-network host \
-image nginx:alpineСетевой доступ: bridge-контейнеры получают интернет и DNS из коробки (по умолчанию
8.8.8.8/8.8.4.4, свой сервер — через--dns).-network hostнужен только если приложение должно слушать хостовые интерфейсы напрямую.
| Concept | Description |
|---|---|
| Image | Read-only rootfs (python:3.11-slim, nginx:alpine). Pulled once via cardinal pull. |
| Container | Image + writable overlay layer. Changes live in the overlay, not the image. |
| Overlay | Diff layer on top of the image. Persists across restarts — packages stay installed. Stays mounted after stop — browse with cardinal fs. |
| Volume | Host bind mount into the container. -v /data/mybot:/bot mounts /data/mybot as /bot. |
| Network | Every container gets IP 10.0.2.X on bridge cardinal0. Host at 10.0.2.1. |
Host: cardinal0 10.0.2.1/24
Container A: eth0 10.0.2.2
Container B: eth0 10.0.2.3
A → host: ping 10.0.2.1 (host is gateway)
host → A: ping 10.0.2.2 (host has route)
A → B: ping 10.0.2.3 (via bridge)
A → B's port: curl 10.0.2.1:8080 (DNAT: host_port → B:container_port)
cardinal pull alpine # Pull image
cardinal pull nginx:alpine # With tag
cardinal search nginx # Search Docker Hub
cardinal images # List local images
cardinal rmi nginx:alpine # Remove image
cardinal verify nginx:alpine # Verify image digestscardinal run --rm alpine echo hi # One-shot
cardinal run -d -n web -p 80:80 nginx # Detached
cardinal run -i -t alpine sh # Interactive
cardinal ps -a # List all containers
cardinal stop web # Stop (files remain accessible via cardinal fs)
cardinal start web # Start stopped
cardinal restart web # Restart
cardinal rm -f web # Force remove (deletes files)
cardinal rename web web-new # Rename container
cardinal set web --memory 2g --cpus 4 # Change container params (preserves data)
cardinal set web --restart always # Enable auto-restart
cardinal set web --restart-delay 1m # Wait 1 minute before recovery
cardinal set web --restart-max-attempts 10 # Allow 10 crash restarts before blocking
cardinal backup enable web --interval 6h --retention 14 # Scheduled backups
cardinal backup status web # Show backup settings
cardinal backup disable web # Disable scheduled backups
cardinal system df # Show disk usage by images, containers, volumes
cardinal system prune # Remove unused containers, images and volumes
cardinal info # System information
cardinal commit web my-image:v1 # Create image from containerCheck how much disk space cardinal is using:
cardinal system dfOutput:
TYPE TOTAL SIZE PATH
Images (3) 45.2 GB 12 items /root/.cardinal/images
Containers (5) 2.1 GB 10 items /root/.cardinal/containers
Overlay (5) 1.8 GB 20 items /root/.cardinal/overlay
Volumes (2) 512.0 MB 8 items /root/.cardinal/volumes
Logs (3) 128.5 MB 3 items /root/.cardinal/logs
Backups 2.3 GB 6 items /root/.cardinal/backups
Cache 3.1 GB 15 items /root/.cardinal/cache
Total disk usage: 55.1 GB
Data directory: /root/.cardinal
Scheduled backups are managed by the persistent systemd supervisor. The archive includes the container writable overlay and named volumes, but not host bind mounts. To keep the archive consistent, cardinal briefly stops a running container, creates the backup, then starts it again. Enabling a schedule does not create an archive immediately; the first archive is created after the configured interval.
cardinal backup enable minecraft --interval 6h --retention 14
cardinal backup status minecraft
cardinal backup list
cardinal backup disable minecraftBackups are stored by default under $CARDINAL_DATA_DIR/backups/<container>/. Use a dedicated directory when desired:
cardinal backup enable minecraft --interval 24h --retention 7 --dir /data/backups/minecraftThe supervisor must be installed for scheduled backups to run after the CLI exits:
cardinal bootstrap --installManual backups remain available with cardinal backup create; restore only into a stopped container. Verify an archive with cardinal backup verify FILE.tar.gz.
A new container start creates a fresh cardinal stdout/stderr log. Application-owned logs in bind mounts or named volumes are preserved.
cardinal logs web # Current run
cardinal logs --previous web # Previous run
cardinal logs --all web # Current + rotated runs
cardinal logs -f web # Follow current run
cardinal attach web # Recent output + live stdin/stdout
cardinal fs ls web /etc/nginx # List files in container
cardinal fs cat web /etc/nginx/conf.d/default.conf # Show file
cardinal fs find web --name "*.conf" # Search files
cardinal exec web cat /etc/hostname # Run command inside
cardinal exec -i -t web /bin/sh # Interactive shell
cardinal console web # Auto-detect shell
cardinal top web # Processes inside containerBrowse container files without starting a shell:
cardinal fs ls <container> [path] # List files
cardinal fs cat <container> <path> # Show file content
cardinal fs tree <container> [path] # Directory tree
cardinal fs find <container> [path] [flags] # Find files
--name <pattern> Filter by name (glob, e.g. "*.conf")
--grep <text> Search inside files
--type f|d Files or directories only
--max-depth <n> Max recursion depthExamples:
cardinal fs ls web /etc/nginx
cardinal fs cat web /etc/nginx/conf.d/default.conf
cardinal fs tree mc-server /data --max-depth 2
cardinal fs find web --name "*.conf" --grep "server_name"Works on both running and stopped containers — overlay stays mounted after cardinal stop.
Copy files between host and container without rebuilding:
# Copy from host to container
cardinal cp app.py web:/app/ # Single file
cardinal cp ./static/ web:/usr/share/nginx/html/ # Directory
cardinal cp ./bot.py discord-bot:/bot/ # Bot code
# Copy from container to host
cardinal cp web:/etc/nginx/nginx.conf . # Backup config
cardinal cp web:/var/log/nginx/ ./logs/ # Backup logs
# Upload files to running container
cardinal cp ./index.html web:/usr/share/nginx/html/index.html
cardinal cp ./config.yml myapp:/etc/app/config.ymlUse -v (bind mount) for live file sharing — changes on host are instantly visible inside the container.
cardinal attach is Ctrl+C safe — container keeps running.
exec vs attach:
attachconnects to the main process stdin/stdout.execruns a new command inside the container.consoleis a shortcut forexec -i -twith auto-detected shell.
| Flag | Description |
|---|---|
-d |
Detach (background) |
-n |
Container name |
-p |
Port mapping host:container[/proto]; host ranges like 8000-8010:80 are supported |
-v |
Volume mount src:dst (add :ro/:rw for read-only/read-write) |
-e |
Environment variable (repeatable) |
-i |
Interactive (keep stdin) |
-t |
Allocate TTY |
--rm |
Auto-remove on exit |
--restart |
Restart policy: no, always, on-failure, unless-stopped (always/unless-stopped are supervised for detached containers) |
--restart-delay |
Wait before automatic restart (e.g. 10s, 1m) |
--restart-max-attempts |
Crash-loop budget: automatic restart is blocked after N failures within the window (default 5) |
--restart-window |
Window for the crash-loop budget (e.g. 10m, 1h) |
--memory |
RAM limit (e.g. 512m, 2g) |
--cpus |
CPU limit (e.g. 1.5, 4) |
--disk |
Disk limit (e.g. 10G) |
-h |
Hostname |
--startup |
Startup script (inline or @file) — overrides CMD |
--healthcheck-cmd |
Health check command |
--healthcheck-interval |
Health check interval (seconds) |
--healthcheck-retries |
Health check retries |
--healthcheck-timeout |
Health check timeout (seconds) |
--seccomp-profile |
Accepted but not yet enforced (fails closed); planned |
--apparmor-profile |
Accepted but not yet enforced (fails closed); planned |
--isolated |
Isolate container from other containers (network segmentation) |
--encrypted-backup |
Encrypt backup archives with AES-256-GCM |
--audit-log |
Enable audit logging for container events |
cardinal run -d --restart always -n web -p 80:80 nginx:alpine
curl localhostmkdir -p /data/flask-app && cd /data/flask-app
cat > app.py << 'EOF'
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello from cardinal!'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
EOF
echo "flask==3.0.0" > requirements.txt
cardinal run -d --restart always \
-n flask -p 5000:5000 \
-v /data/flask-app:/app \
python:3.11-slim sh -c "\
pip install -r /app/requirements.txt && \
python /app/app.py"
curl http://localhost:5000cardinal run -d --restart always \
-n pg -p 5432:5432 \
-v pg_data:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=secret \
-e POSTGRES_DB=myapp \
postgres:16
psql -h localhost -U postgres -d myappcardinal run -d --restart always \
-n mysql -p 3306:3306 \
-v mysql_data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=rootpass \
-e MYSQL_DATABASE=myapp \
mysql:8
mysql -h localhost -u root -prootpass myappcardinal run -d --restart always \
-n redis -p 6379:6379 \
-v redis_data:/data \
redis:7 --appendonly yes
redis-cli -h localhost ping# Pre-built image (itzg/minecraft-server)
cardinal run -d --restart always \
-n mc -p 25565:25565 \
-v mc_data:/data \
-e EULA=TRUE -e TYPE=PAPER -e VERSION=1.20.4 \
-e MEMORY=2G -e DIFFICULTY=normal \
itzg/minecraft-serverСначала создай скрипт mc-startup.sh:
#!/bin/bash
# ==============================================================
# Paper Minecraft Server download and startup script
# Version: 1.21.11 (build 116)
# ==============================================================
set -e
# --- Version and URL (your direct link) ---
SERVER_JAR="paper-1.21.11-116.jar"
API_URL="https://fill-data.papermc.io/v1/objects/e708e8c132dc143ffd73528cccb9532e2eb17628b1a0eee74469bf466c7003f8/paper-1.21.11-116.jar"
# --- Java ---
JAVA_CMD="java"
JDK_DIR="./jdk"
check_java_version() {
local cmd="$1"
if ! command -v "$cmd" &>/dev/null; then
return 1
fi
local ver
ver=$("$cmd" -version 2>&1 | head -1 | cut -d '"' -f2 | sed 's/^1\.//' | cut -d '.' -f1)
[ "$ver" -ge 21 ]
}
# --- Local Java ---
if [ -f "$JDK_DIR/bin/java" ]; then
echo "ℹ️ Found local Java in $JDK_DIR"
if check_java_version "$JDK_DIR/bin/java"; then
JAVA_CMD="$JDK_DIR/bin/java"
echo "✅ Using local Java 21+"
else
echo "⚠️ Local Java is outdated. Removing it."
rm -rf "$JDK_DIR"
fi
fi
# --- System Java or download ---
if [ "$JAVA_CMD" = "java" ]; then
if check_java_version "java"; then
echo "✅ Found system Java 21+"
else
echo "⬇️ Downloading Java 21..."
JDK_URL="https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz"
JDK_TAR="OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz"
curl -# -L -o "$JDK_TAR" "$JDK_URL" || { echo "❌ Failed to download Java"; exit 1; }
mkdir -p "$JDK_DIR"
tar -xzf "$JDK_TAR" -C "$JDK_DIR" --strip-components=1 || { echo "❌ Failed to extract Java"; exit 1; }
rm -f "$JDK_TAR"
[ -f "$JDK_DIR/bin/java" ] || { echo "❌ Java not found after extraction"; exit 1; }
JAVA_CMD="$JDK_DIR/bin/java"
echo "✅ Java 21 installed locally."
fi
fi
# --- Final Java check ---
[ -x "$JAVA_CMD" ] || { echo "❌ Error: Java not found ($JAVA_CMD)"; exit 1; }
echo "🔍 Using Java: $("$JAVA_CMD" -version 2>&1 | head -1)"
# --- JAR validation (ZIP signature) ---
is_jar_valid() {
local f="$1"
[ -f "$f" ] || return 1
local hex
hex=$(dd if="$f" bs=1 count=4 2>/dev/null | od -An -tx1 | tr -d ' ')
[ "$hex" = "504b0304" ]
}
# --- Download Paper with response check ---
download_paper() {
echo "⬇️ Downloading Paper 1.21.11 (build 116)..."
http_code=$(curl -s -L -w "%{http_code}" -o "$SERVER_JAR" "$API_URL")
if [ "$http_code" -ne 200 ]; then
echo "❌ HTTP error $http_code."
if [ -f "$SERVER_JAR" ]; then
echo " Response content (first 5 lines):"
head -n 5 "$SERVER_JAR"
fi
rm -f "$SERVER_JAR"
return 1
fi
if is_jar_valid "$SERVER_JAR"; then
echo "✅ Download successful, JAR is valid."
return 0
else
echo "❌ Downloaded file is corrupted or not a JAR."
rm -f "$SERVER_JAR"
return 1
fi
}
# --- Download logic ---
if [ -f "$SERVER_JAR" ] && is_jar_valid "$SERVER_JAR"; then
echo "ℹ️ File $SERVER_JAR already exists and is valid."
else
[ -f "$SERVER_JAR" ] && rm -f "$SERVER_JAR"
if ! download_paper; then
echo "⚠️ First attempt failed. Retrying in 5 seconds..."
sleep 5
if ! download_paper; then
echo "❌ Failed to download a valid JAR after two attempts."
exit 1
fi
fi
fi
# --- EULA ---
if [ ! -f "eula.txt" ]; then
echo "📄 Creating eula.txt..."
echo "eula=true" > eula.txt
else
echo "ℹ️ eula.txt already exists."
fi
# --- Memory settings ---
MAX_PERCENT=${MAX_RAM_PERCENT:-80.0}
INIT_PERCENT=${INIT_RAM_PERCENT:-40.0}
echo "🧠 JVM: MaxRAMPercentage=$MAX_PERCENT%, InitialRAMPercentage=$INIT_PERCENT%"
# --- Launch ---
echo "🚀 Starting Paper 1.21.11 (build 116) server..."
exec "$JAVA_CMD" -XX:MaxRAMPercentage="$MAX_PERCENT" -XX:InitialRAMPercentage="$INIT_PERCENT" -jar "$SERVER_JAR" noguiПростой запуск (Java уже в образе, jar на сервере):
cardinal run -d --restart always \
-n mc-paper -p 25565:25565 \
-v $PWD:/data --memory 4G --cpus 4 \
-workdir /data \
-network host \
eclipse-temurin:21-jdk \
java -Xmx3500M -jar paper-1.21.11-116.jar noguiDNS в контейнере: bridge-контейнеры резолвят внешние хосты из коробки (дефолт
8.8.8.8/8.8.4.4, переопределить — флагом--dns).-network hostнужен только для прямого доступа к сети хоста, не для DNS.
More Minecraft examples (modded servers, custom JARs, backups) → docs/en/websites.md
Full bot deployment guide → docs/en/bots.md
Upload your website, bot code, or configs into a running container:
# Website files
cardinal cp ./index.html mc:/usr/share/nginx/html/
cardinal cp ./style.css mc:/usr/share/nginx/html/
# Bot code
cardinal cp ./bot.py discord-bot:/bot/
cardinal cp ./config.yml tg-bot:/bot/
# App configs
cardinal cp ./nginx.conf web:/etc/nginx/conf.d/default.conf
# Entire directories
cardinal cp ./static/ web:/usr/share/nginx/html/static/See deployment docs for more.
mkdir -p /data/node-app && cd /data/node-app
cat > index.js << 'EOF'
const http = require('http');
http.createServer((req, res) => res.end('Hello from cardinal!\n')).listen(3000);
EOF
cardinal run -d --restart always \
-n node-app -p 3000:3000 \
-v /data/node-app:/app \
node:20 node /app/index.js
curl http://localhost:3000mkdir -p /data/discord-bot && cd /data/discord-bot
cat > bot.py << 'EOF'
import os, discord
from discord.ext import commands
TOKEN = os.environ["BOT_TOKEN"]
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
@bot.command()
async def ping(ctx):
await ctx.send("pong")
bot.run(TOKEN)
EOF
echo "discord.py==2.4.0" > requirements.txt
cardinal run -d --restart always \
-n discord-bot \
-v /data/discord-bot:/bot \
--workdir /bot \
-e BOT_TOKEN=your_token_here \
--startup "pip install -r /bot/requirements.txt && exec python /bot/bot.py" \
python:3.11-slimmkdir -p /data/tg-bot && cd /data/tg-bot
cat > bot.py << 'EOF'
import os
from telegram import Update
from telegram.ext import Application, CommandHandler
TOKEN = os.environ["BOT_TOKEN"]
async def start(update: Update, context):
await update.message.reply_text("Hello from cardinal!")
async def ping(update: Update, context):
await update.message.reply_text("pong")
app = Application.builder().token(TOKEN).build()
app.add_handler(CommandHandler("start", start))
app.add_handler(CommandHandler("ping", ping))
app.run_polling()
EOF
echo "python-telegram-bot==20.7" > requirements.txt
cardinal run -d --restart always \
-n tg-bot \
-v /data/tg-bot:/bot \
--workdir /bot \
-e BOT_TOKEN=your_token_here \
--startup "pip install -r /bot/requirements.txt && exec python /bot/bot.py" \
python:3.11-slim# 1. PostgreSQL
cardinal run -d --restart always \
-n bot-db \
-v bot_pgdata:/var/lib/postgresql/data \
-e POSTGRES_DB=botdb \
-e POSTGRES_USER=bot -e POSTGRES_PASSWORD=secret \
postgres:16
# 2. Bot connects via 10.0.2.1
cardinal run -d --restart always \
-n db-bot \
-v /data/mybot:/bot \
-e BOT_TOKEN=token -e DB_HOST=10.0.2.1 \
--startup "pip install -r /bot/requirements.txt && exec python /bot/bot.py" \
python:3.11-slimPackages install into the overlay and persist across restarts cardinal.
cardinal-wings is a REST API daemon for managing containers remotely. It runs as a systemd service and allows frontends (like cardinal-panel) to control containers over HTTP.
# Install (GitHub Releases; prints URL + API token for the panel)
curl -fsSL https://github.com/animesao/cardinal-wings/releases/latest/download/install.sh -o /tmp/install-wings.sh
sudo bash /tmp/install-wings.sh
# Start
systemctl enable --now cardinal-wings
# API (auth via Bearer token from /etc/cardinal-wings/config.toml)
curl -H "Authorization: Bearer <api_key>" http://localhost:8080/v1/containersIf GitHub is unreachable (e.g.
curl: (28) SSL connection timeout), install cardinal-wings manually from its GitHub releases. The cardinal installer downloads everything exclusively from the official cardinal repository.
Add or remove port mappings on running containers without restart.
# Add a port
cardinal port add <container> <host>:<container>[/proto]
# Remove a port
cardinal port remove <container> <host>[/proto]
cardinal port rm <container> <host>[/proto] # alias- Applies iptables DNAT rules instantly — no restart needed
- Ports persist in container state across restarts
Containers with --restart always or --restart unless-stopped start automatically after reboot. cardinal installs a persistent systemd supervisor when you run a container with an automatic restart policy. The supervisor survives the short-lived cardinal run -d command and owns boot recovery; the container monitor applies --restart-delay after crashes.
Repeated quick crashes are protected by a crash-loop budget (default 5 restarts, tunable with --restart-max-attempts and --restart-window). Once the budget is exhausted, automatic restart is blocked — cardinal inspect NAME then shows "restart_blocked": true — and the container stays stopped until an explicit cardinal start.
cardinal bootstrap --install # install and start the supervisor
cardinal bootstrap --remove # stop and remove it
systemctl status cardinal-bootstrapSystem boot → systemd → cardinal-bootstrap.service → cardinal supervisor
└─ Adopt detached containers with an automatic restart policy
1. Setup overlayfs
2. Run unshare with namespaces
3. Setup veth + iptables
4. Monitor crashes and apply restart-delay
Define containers in a TOML file, start everything with one command.
[container.web]
image = "nginx:alpine"
ports = ["80:80", "443:80", "8000-8002:8080"]
volumes = ["./html:/usr/share/nginx/html"]
restart = "always"
[container.db]
image = "postgres:16"
ports = ["5432:5432"]
env = { POSTGRES_PASSWORD = "secret", POSTGRES_DB = "myapp" }
volumes = ["pg_data:/var/lib/postgresql/data"]
restart = "always"cardinal up # Create/start all containers
cardinal up web # Start only web
cardinal down # Stop/remove all
cardinal down -a # Remove ALL containers (ignore config)| Field | Description | Example |
|---|---|---|
image |
Container image (required) | "nginx:alpine" |
command |
Startup command | "python3 app.py" |
ports |
Port mappings (ranges like 8000-8010:80 supported) |
["443:80", "3000:3000"] |
volumes |
Volume mounts | ["./data:/data"] |
env |
Environment variables | { KEY = "val" } |
restart |
Restart policy | "always" (default) |
hostname |
Container hostname | "myserver" |
healthcheck |
Health check config | { cmd = "...", interval = 30, retries = 3, timeout = 5 } |
Healthcheck runs the command inside the container at the given interval. After retries consecutive failures, the container is killed and restarted.
Use --startup to run a custom script instead of the image's default command:
# Inline script
cardinal run -d --startup "#!/bin/sh\necho 'Hello from startup'" alpine sleep infinity
# Load from file
cardinal run -d --startup @./myscript.sh ubuntuThe script is written to /startup.sh inside the container and executed via /bin/sh. When a startup script is present, it overrides the normal CMD/entrypoint.
The following environment variables are injected automatically for startup scripts:
| Variable | Description |
|---|---|
CARDINAL_CONTAINER_ID |
Container ID |
CARDINAL_CONTAINER_NAME |
Container name |
CARDINAL_IMAGE_NAME |
Image name |
CARDINAL_IMAGE_TAG |
Image tag |
CARDINAL_HOSTNAME |
Container hostname |
CARDINAL_MEMORY |
Memory limit (bytes) |
CARDINAL_CPU |
CPU limit (cores) |
CARDINAL_IP |
Container IP address |
CARDINAL_RESTART |
Restart policy |
Storage: `$CARDINAL_DATA_DIR` (default: `/root/.cardinal/`)
images/ OCI rootfs per tag
containers/ State JSON files
overlay/ upper/work/merged per container
logs/ Container stdout/stderr
consoles/ Unix sockets for attach
networks/ IP allocation pool
cardinal run -d
├─ unshare --fork --pid --mount --net --uts --ipc cardinal init <id>
│ └─ cardinal init → pivot_root to overlay → setup /proc/lo/eth0 → exec CMD
└─ cardinal console-serve <id>
├─ reads stdout pipe
├─ writes to log file
├─ listens on Unix socket
└─ broadcasts to all attach clients
| Feature | cardinal | Docker |
|---|---|---|
| Daemon | No daemon | dockerd required |
| Binary size | ~5 MB | ~100+ MB |
| Namespaces | PID, Mount, Net, UTS, IPC | All |
| Bridge network | cardinal0 (10.0.2.0/24) | docker0 |
| Port mapping | iptables DNAT | iptables DNAT |
| Auto-start | persistent systemd supervisor | systemd dockerd |
| Image format | OCI/Docker V2 | OCI/Docker V2 |
| Multi-stage build | ✅ | ✅ |
| Compose depends_on | ✅ | ✅ |
| Cluster orchestration | ✅ | ✅ (Swarm) |
| Rolling updates | ✅ | ✅ |
| Seccomp profile | ❌ (planned, fail-closed) | ✅ |
| AppArmor profile | ❌ (planned, fail-closed) | ✅ |
| Network segmentation | ✅ (--isolated) | ✅ (network policies) |
| Backup encryption | ✅ (AES-256-GCM) | ❌ |
| Audit logging | ✅ | ❌ (auditd integration) |
Point the CLI at a remote cardinal serve with --host/-H and --token
(or CARDINAL_REMOTE_HOST / CARDINAL_TOKEN env). Besides ps, info and
logs --tail, remote mode supports start, stop, restart, logs -f,
exec, stats, top, inspect and events:
cardinal --host http://192.168.1.10:2375 start web
cardinal --host http://192.168.1.10:2375 stop web
cardinal --host http://192.168.1.10:2375 stop --all
cardinal --host http://192.168.1.10:2375 restart web
cardinal --host http://192.168.1.10:2375 logs -f web
cardinal --host http://192.168.1.10:2375 exec web cat /etc/hostname
cardinal --host http://192.168.1.10:2375 stats web --no-stream
cardinal --host http://192.168.1.10:2375 top web
cardinal --host http://192.168.1.10:2375 inspect web
cardinal --host http://192.168.1.10:2375 events --since 2026-10-04T00:00:00Zstop --all lists containers remotely and stops each one client-side (continues on error).
Limits:
- No interactive exec:
-i/-tfail loudly (use localcardinal execor the wings terminal). - Remote
statspolls?stream=0once per second (no server-side stream). - Remote
inspectreturns Docker-schema JSON fromserve, which differs from the local state dump;--sensitiveis a no-op remotely. - Remote
events --sincefilters client-side from subscribe time. logs --previous/--allstay local-only.- Remote
logs -fsurvives log rotation (offset reset on freshstart) but ends if the container is removed.
cardinal serve exposes a Docker-compatible REST API: whoever can call it
can exec into and create arbitrary containers — that is root on the host.
So the API is gated by a Bearer token, required on any bind since v2.3.13
(loopback included; previously 127.0.0.1 worked without one, which meant
any local process — or any container, via the gateway — could drive it).
Generate a token once:
openssl rand -hex 32Run with it (flag or env — flag wins if both are set):
cardinal serve -H 127.0.0.1 -p 2375 --token <токен>
CARDINAL_TOKEN=<токен> cardinal serve -H 127.0.0.1 -p 2375Call the API with the token:
curl -s -H "Authorization: Bearer <токен>" http://127.0.0.1:2375/version
curl -s -H "Authorization: Bearer <токен>" http://127.0.0.1:2375/containers/jsonSystemd unit (the token is root-equivalent — keep the file 0600):
[Service]
ExecStart=/usr/local/bin/cardinal serve -H 127.0.0.1 -p 2375
Environment=CARDINAL_TOKEN=<токен>sudo chmod 600 /etc/systemd/system/cardinal-serve.service
sudo systemctl daemon-reload && sudo systemctl restart cardinal-serveNotes:
- External binds (
-H 0.0.0.0) additionally want--tls-cert/--tls-key, otherwise the Bearer token travels in cleartext. cardinal-wingspasses a random token itself when it spawnscardinal serve— nothing to configure there.- Portainer / remote CLI: same
Authorization: Bearer <токен>header (cardinal --host http://IP:2375 --token <токен> ...).
v2.4.14 - Security hardening release. Added unprivileged exec-helper execution with context.WithTimeout, clean environment, and capability dropping for container healthchecks (execHealthcheck) and container copy commands (CopyFromContainer, CopyToContainer), preventing host root execution leaks and container escapes. Volume permission adjustment walks in InitContainer now skip symbolic links to guard against symlink path traversal attacks. Bumped Go language version to 1.26.10.
v2.4.13 - Security hardening release. Added SSRF and DNS rebinding protections to registry host validation (checkRegistryHostNotInternal verifies resolved IPs against private, loopback, and metadata ranges). IsProtectedHostPath ensures sensitive credential directories (.ssh, .aws, .kube, .docker, .gnupg, .netrc) remain blocked from container bind mounts even when parent folders are allowlisted. Bounded timeouts applied across cluster peer RPCs and heartbeats, avoiding stalls from unresponsive nodes. forwardToFunction in FaaS now caps response sizes at 32 MB and sets a 30-second timeout, guarding against memory exhaustion DoS.
v2.4.12 - Version and tag alignment release. VERSION now reads 2.4.12 and the annotated v2.4.12 tag points at this commit, so the tag-consistency gate, release artefacts, and the checksum manifest all agree on the declared version. The previous v2.4.12 tag pointed at the v2.4.11 release commit and would have failed tag matches VERSION. No runtime changes.
v2.4.11 - Published ports bound to 127.0.0.1 now work. -p 127.0.0.1:8080:80 created the DNAT rule but the kernel dropped loopback-sourced packets on the bridge interface, and reverse NAT sent replies back to 127.0.0.1 into the INPUT filters. The runtime now installs a scoped POSTROUTING MASQUERADE (-s 127.0.0.0/8 -d <bridge subnet>) plus net.ipv4.conf.<bridge>.route_localnet=1 for that bridge, with both INPUT guards exempting ESTABLISHED,RELATED and still failing closed; CARDINAL_ROUTE_LOCALNET=1 remains an optional global opt-in. cardinal run no longer reorders or drops container arguments that follow the image, so cardinal run alpine echo --help reaches the container intact. Go dependencies were bumped (prometheus/client_golang 1.25.0, x/sys 0.49.0), GitHub Actions moved to the Node 24 majors (checkout@v7, setup-go@v7, upload-artifact@v7, download-artifact@v8), and the stale npm Dependabot entry that failed every run with dependency_file_not_found was removed.
v2.4.10 - cardinal system prune now removes unused volumes as well as containers, images and overlay directories. Volumes outlive their containers, so a node with no containers kept its volumes forever: system prune reported "Nothing to prune" while the disk was full and SQLite refused every write with "database or disk is full". A volume that is still mounted by a container is never removed.
v2.4.9 - The runtime is built with Go 1.26.10, the first release carrying the crypto/x509 fix for GO-2026-6809 (distrust of compromised intermediate certificates). Go 1.26.9 carried the vulnerability, so a runtime built with it stayed exposed when validating certificate chains. go.mod and every build workflow now pin 1.26.10. Update a node with sudo cardinal update.
v2.4.8 - Fix: cardinal update no longer fails on the signature check. Verification was on by default but looked for a signature next to the per-file checksums (cardinal_<ver>_checksums.txt.sig, which the release does not contain) and pinned the certificate identity to release.yml, a workflow that does not exist in the repository - the release is signed by build.yml, and the signature lives next to the SHA256SUMS.txt manifest. Both are fixed: the manifest itself is verified (it covers every release artifact at once) and the identity points at build.yml, bound to the tag. The signature and certificate are now uploaded to the release (they were created and dropped before). When a release is unsigned the error says so instead of "cosign binary not found". New CARDINAL_COSIGN_PUBKEY points at an on-disk public key - it lives in the repository, so a compromised release host cannot forge a signature and cosign is not needed on the host. Signature verification stays on by default; set CARDINAL_REQUIRE_SIGNATURE=0 for unsigned releases (the check runs before the new binary is written to disk and before the installed binary is replaced).
v2.4.7 - Security: cardinal exec no longer runs the command with the daemon's credentials. The container's own profile - capability set without SYS_ADMIN and MKNOD, the container user, no_new_privs and the seccomp filter - is applied inside the container before the command starts, which closes the mknod + mount escape. The daemon's environment (CARDINAL_TOKEN, CARDINAL_BACKUP_KEY, DOCKER_PASSWORD) no longer reaches tenant containers. POST /containers/create rejects a conflicting host port (409) instead of stealing the DNAT rule of another container, the API rejects foreign Origin and Host headers, the registry allowlist is strict by default (CARDINAL_REGISTRY_STRICT=0 to relax), release signatures are verified by default (CARDINAL_REQUIRE_SIGNATURE=0 to skip), the backup key is derived with PBKDF2 over a per-archive salt, and cardinal build gets a fresh procfs so a RUN step cannot reach /proc/1/root. Behaviour change: containers started before this release need one restart before cardinal exec works again.
v2.4.6 - Behaviour change: every container now gets a seccomp filter. mount, pivot_root, chroot, bpf, ptrace, keyctl and friends return EPERM inside the container; everything else is untouched (allow-by-default). --cap-add does not lift it - set CARDINAL_SECCOMP=0 for containers that genuinely need mount/chroot. Fail-closed: if the filter cannot be installed the container refuses to start.
v2.4.5 - Internal: the default seccomp profile is really compiled now - an AUDIT_ARCH_* guard, an x32 range reject on amd64 and a per-syscall deny list, with syscall numbers taken from unix.SYS_* in per-arch tables. The profile switched to allow-by-default because the previous KILL-by-default allow-list omitted futex/epoll_*/statx/rseq and would have killed every container. Not yet enabled in container init; --seccomp-profile still errors instead of pretending to work. No behaviour change in this release.
v2.4.4 - Security: 9 stdlib CVEs (net/http, net/textproto, crypto/tls) closed by building against Go 1.26.9 - go.mod now pins toolchain go1.26.9, and the scheduled scan, e2e, install.ps1 and snapcraft.yaml all use it. internal/image builds again on non-Linux (the registry allowlist was behind a //go:build linux tag although the code is platform-neutral).
v2.4.3 - Disk limits no longer block container starts on hosts without loop devices (LXC/OpenVZ-style VDS): cardinal warns and runs without a quota; CARDINAL_STRICT_DISK_LIMIT=1 keeps it fail-closed. cardinal doctor reports the capability.
v2.4.2 — Diagnostics: disk-limit mount failures name the missing piece (image, mount point, loop devices) instead of a bare ENOENT.
v2.4.1 — Fix rollup: cobra wrapper keeps serve bind/auth flags (tokenless spawns refused since v2.3.13 are fixed); disk-limit setup surfaces mkdir errors instead of a cryptic mount failure.
v2.3.14 — Fix: cobra wrapper больше не выдёргивает --token/-H из cardinal serve (флаг доходил пустым, serve с обязательным токеном отказывался стартовать — ломал спавн из wings и e2e).
v2.3.13 — Security hardening: minimal container /dev (pruned to pseudo-devices, MKNOD out of the default capabilities), API refuses to serve without a token (loopback included), registry token-realm pinning, decompression-bomb caps on layer extraction, registry allowlist enforced on pull/push, egress DROP for 127/8 + 169.254/16, backup-restore warning without checksum sidecar, blueprint repos https-only, cluster RPCs fail closed without token, no-echo password prompt in login.
v2.3.12 — cardinal attach: ввод консоли пишется в лог (фикс errcheck в CI).
v2.3.11 — cardinal attach: ввод консоли пишется в лог с префиксом > — реконнекты возвращают команды рядом с ответами, а не одни ответы.
v2.3.10 — cardinal attach: реплей хвоста лога начинается с границы строки (без обрубков, дедуп на панели срабатывает, команды рядом с ответами).
v2.3.9 — cardinal attach: локальное эхо piped-строк stdin (фикс errcheck в CI).
v2.3.8 — cardinal attach показывает набираемые строки при piped-вводе (stdin контейнера — pipe без эха; в терминале поведение не изменилось).
v2.3.7 — Security hardening: serve unit with the API token is written 0600 (was world-readable), DNS/hostnames are validated before landing in resolv.conf and neighbours' /etc/hosts, port protocols are allowlisted before reaching iptables.
v2.3.6 — cardinal stats redraws the table in place instead of scrolling (both local and remote modes).
v2.3.5 — Stats fix: disk_usage_bytes now includes named volumes (servers kept in volumes/ showed kilobytes on gigabyte data); full tree walks cached per container (60s TTL).
v2.3.1 — Green build: test-harness fixes only (errcheck-clean stubs, race-free SSE/logs-follow tests). No runtime changes since v2.3.0.
v2.3.0 — Remote mode expansion: exec (captured output), stats, top, inspect, events (SSE), start/stop/restart and streaming logs -f via cardinal --host URL [--token]; host-port conflict warnings in run/port add.
v2.2.0 — Read-only remote mode: cardinal --host URL [--token] queries a remote cardinal serve for ps, info and logs --tail (new internal/client, CARDINAL_REMOTE_HOST/CARDINAL_TOKEN env).
v1.24.0 — Major security hardening: seccomp profile (blocks 30+ dangerous syscalls), AppArmor profile, device restrictions (/dev/shm, /dev/mqueue, /proc/sys, /sys read-only), network segmentation (--isolated), backup encryption (AES-256-GCM with --encrypt), audit logging for container lifecycle events, new CLI flags (--seccomp-profile, --apparmor-profile, --isolated, --encrypted-backup, --audit-log).
v1.23.0 — Persistent restart supervisor with configurable delays and crash-loop protection (--restart-max-attempts/--restart-window, restart_blocked), per-container scheduled backups with checksum verification (cardinal backup verify), offline image verification (cardinal verify), reliable cardinal update, runtime hardening (zombie-exit detection, cardinal rm tombstones, safe OCI layer extraction, protected bind sources, :ro/:rw and tmpfs/NFS volume modes), instant startup for --network none/host containers, and the complete bilingual EN/RU documentation suite.
v1.22.38 — Reliable cardinal update (5-minute download timeout, per-method errors), crash-loop protection with --restart-max-attempts/--restart-window and restart_blocked state, zombie-exit detection so exited detached containers are finalized and restarted on schedule, cardinal rm no longer races supervisor auto-restarts (tombstone marker), and instant startup for --network none/host containers (no 20s eth0 wait).
v1.22.31 — OCI image extraction, protected bind-source validation, persistent restart policies with delays and systemd recovery, rotated cardinal logs, inspect JSON, manual and scheduled safe container backups with retention, cluster orchestration, FaaS, blueprints, services, Compose, healthchecks, startup scripts, dynamic ports, events, stats, Docker-compatible REST API, cross-architecture CI builds, read-only doctor/security diagnostics, optional HTTPS API, and complete EN/RU CLI references with practical examples.
v1.20.0 — Dynamic port management (cardinal port add/rm). Russian (ru) docs.
v1.15.0 — pivot_root security fix. cardinal stop --all. cardinal exec -i/-t flags. Disk limit fix.
v1.14.0 — Disk limit support (--disk). Multi-arch image resolution.
v1.13.0 — --startup flag, --healthcheck-* flags, CARDINAL_* env vars, cgroups v2 resource limits.
v1.11.0 — Debian packaging, APT repository, release workflow.
v1.10.0 — cardinal stats command (live CPU/RAM/IO/PIDs from cgroup v2).
v1.4.7 — cardinal attach rewritten (Unix socket, history + live, Ctrl+C safe).
v1.3.0 — cardinal.toml config, cardinal up/cardinal down.
v1.1.0 — First stable release.
cardinal updateDownloads the latest binary and replaces /usr/local/bin/cardinal. The download allows up to five minutes; if it fails, each method (Go client, curl, wget) reports its own error. For manual installation, see Section 2 of the Running Guide.
- Contributors and contribution guide
- Security model and vulnerability reporting
- Build, CI, and versioning — local checks, cross-compilation, and release automation
cardinal bootstrap --remove
rm /usr/local/bin/cardinal
rm -rf ~/.cardinalThe project maintainer and verified contributors are listed in
CONTRIBUTING.md. GitHub's contributor graph is generated
from commit authors, so contributors should use their own GitHub identity when
opening pull requests or submitting commits.
- animesao — maintainer and primary author.
- MASHINISTPROJECT — installer, image pull progress bar, uninstall script fixes.
github-actions[bot]— automated release and versioning workflow.dependabot[bot]— automated dependency updates.
See CONTRIBUTING.md for contribution rules and the process for adding new contributors with their permission.
This project is released under the Apache License, Version 2.0. The full license text is in LICENSE.
- License: Apache-2.0 — LICENSE
- Attribution: NOTICE
- Brand policy: TRADEMARKS.md
- Commercial model: COMMERCIAL.md
cardinal-wings is a separate project with its own license (AGPL-3.0-or-later) — see animesao/cardinal-wings.
Contributor and maintainer attribution: CONTRIBUTING.md.
