|
| 1 | +# Sysbox Installer for dstack |
| 2 | + |
| 3 | +A complete Docker-based installer for [Sysbox](https://github.com/nestybox/sysbox) on read-only dstack systems. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- 🚀 **Single-command installation** - One Docker run command installs everything |
| 8 | +- 🔒 **Source-built** - Builds Sysbox from verified Git source (v0.6.7) |
| 9 | +- ✅ **SHA256 verified** - All downloads verified with checksums |
| 10 | +- 🔄 **Smart overlay handling** - Preserves existing /etc configurations |
| 11 | +- 📋 **Systemd integration** - Installs proper systemd services for Sysbox daemons |
| 12 | +- 🔍 **Installation detection** - Checks for existing installations |
| 13 | +- 🧪 **Built-in testing** - Verifies installation with basic and Docker-in-Docker tests |
| 14 | + |
| 15 | +## Quick Start |
| 16 | + |
| 17 | +### Build the Installer |
| 18 | + |
| 19 | +```bash |
| 20 | +cd installer |
| 21 | +chmod +x build.sh |
| 22 | +./build.sh sysbox-installer latest |
| 23 | +``` |
| 24 | + |
| 25 | +### Install Sysbox |
| 26 | + |
| 27 | +**Single command installation:** |
| 28 | +```bash |
| 29 | +docker run --rm --privileged --pid=host --net=host -v /:/host \ |
| 30 | + sysbox-installer:latest |
| 31 | +``` |
| 32 | + |
| 33 | +That's it! The installer will: |
| 34 | +- Check for existing installations |
| 35 | +- Build and install Sysbox from source |
| 36 | +- Handle /etc overlay mount complexities |
| 37 | +- Configure Docker runtime |
| 38 | +- Create and start systemd services |
| 39 | +- Test the installation |
| 40 | +- Show final status |
| 41 | + |
| 42 | +## Manual Steps (if needed) |
| 43 | + |
| 44 | +### Interactive Installation |
| 45 | + |
| 46 | +```bash |
| 47 | +docker run -it --rm --privileged --pid=host --net=host -v /:/host \ |
| 48 | + sysbox-installer:latest bash |
| 49 | +``` |
| 50 | + |
| 51 | +Then run: `/usr/local/bin/install-sysbox-complete.sh` |
| 52 | + |
| 53 | +### Check Build Information |
| 54 | + |
| 55 | +```bash |
| 56 | +docker run --rm sysbox-installer:latest cat /usr/local/share/BUILD_INFO |
| 57 | +``` |
| 58 | + |
| 59 | +## Usage After Installation |
| 60 | + |
| 61 | +### Run Containers with Sysbox |
| 62 | + |
| 63 | +```bash |
| 64 | +# Basic system container |
| 65 | +docker run --runtime=sysbox-runc -it ubuntu bash |
| 66 | + |
| 67 | +# Docker-in-Docker |
| 68 | +docker run --runtime=sysbox-runc -d --name docker-container docker:dind |
| 69 | + |
| 70 | +# Kubernetes-in-Docker |
| 71 | +docker run --runtime=sysbox-runc -d --name k8s-node kindest/node:latest |
| 72 | +``` |
| 73 | + |
| 74 | +### Manage Sysbox Services |
| 75 | + |
| 76 | +```bash |
| 77 | +# Check status |
| 78 | +systemctl status sysbox-mgr sysbox-fs |
| 79 | + |
| 80 | +# Restart services |
| 81 | +systemctl restart sysbox-mgr sysbox-fs |
| 82 | + |
| 83 | +# View logs |
| 84 | +journalctl -u sysbox-mgr -u sysbox-fs |
| 85 | +``` |
| 86 | + |
| 87 | +## File Structure |
| 88 | + |
| 89 | +``` |
| 90 | +installer/ |
| 91 | +├── build.sh # Build script |
| 92 | +├── README.md # This file |
| 93 | +├── docker/ |
| 94 | +│ └── Dockerfile # Multi-stage build with source compilation |
| 95 | +└── scripts/ |
| 96 | + ├── install-sysbox-complete.sh # Main installation script |
| 97 | + ├── verify-downloads.sh # SHA256 verification for downloads |
| 98 | + ├── sysbox-mgr.service # systemd service for sysbox-mgr |
| 99 | + └── sysbox-fs.service # systemd service for sysbox-fs |
| 100 | +``` |
| 101 | + |
| 102 | +## Technical Details |
| 103 | + |
| 104 | +### What the Installer Does |
| 105 | + |
| 106 | +1. **Checks existing installation** - Prompts before overwriting |
| 107 | +2. **Copies binaries** - Places Sysbox binaries in `/tmp/` (writable location) |
| 108 | +3. **Sets up /etc overlay** - Creates persistent overlay preserving existing configs |
| 109 | +4. **Creates symlinks** - Links rsync, modprobe, iptables for Sysbox requirements |
| 110 | +5. **Configures Docker** - Adds sysbox-runc runtime to Docker daemon |
| 111 | +6. **Creates systemd services** - Installs proper service files with dependencies |
| 112 | +7. **Starts services** - Enables and starts Sysbox daemons |
| 113 | +8. **Tests installation** - Verifies basic and Docker-in-Docker functionality |
| 114 | + |
| 115 | +### Data Locations |
| 116 | + |
| 117 | +- **Sysbox data**: `/dstack/persistent/sysbox-data` |
| 118 | +- **Overlay data**: `/dstack/persistent/sysbox-etc-overlay` |
| 119 | +- **Binaries**: `/tmp/sysbox-*` and `/tmp/rsync-static` |
| 120 | + |
| 121 | +### Security |
| 122 | + |
| 123 | +- All downloads verified with SHA256 checksums |
| 124 | +- Sysbox built from official Git repository (recursive clone) |
| 125 | +- Uses specific version tags (v0.6.7) |
| 126 | +- Proper systemd service isolation |
| 127 | + |
| 128 | +## Troubleshooting |
| 129 | + |
| 130 | +### Check Service Status |
| 131 | +```bash |
| 132 | +systemctl status sysbox-mgr sysbox-fs |
| 133 | +journalctl -u sysbox-mgr -u sysbox-fs |
| 134 | +``` |
| 135 | + |
| 136 | +### Verify Docker Runtime |
| 137 | +```bash |
| 138 | +docker info | grep -A5 Runtimes |
| 139 | +``` |
| 140 | + |
| 141 | +### Test Basic Functionality |
| 142 | +```bash |
| 143 | +docker run --runtime=sysbox-runc --rm alpine echo "Test successful" |
| 144 | +``` |
| 145 | + |
| 146 | +### Clean Installation |
| 147 | +```bash |
| 148 | +systemctl stop sysbox-mgr sysbox-fs |
| 149 | +systemctl disable sysbox-mgr sysbox-fs |
| 150 | +rm -f /etc/systemd/system/sysbox-*.service |
| 151 | +umount /etc # If overlay mounted |
| 152 | +rm -rf /dstack/persistent/sysbox-* |
| 153 | +``` |
| 154 | + |
| 155 | +## Requirements |
| 156 | + |
| 157 | +- Docker installed and running |
| 158 | +- Privileged container execution |
| 159 | +- dstack system with ZFS persistent storage |
| 160 | +- systemd for service management |
| 161 | + |
| 162 | +## Support |
| 163 | + |
| 164 | +For issues with the installer, check: |
| 165 | +1. Docker daemon is running |
| 166 | +2. Container has privileged access |
| 167 | +3. `/dstack/persistent/` is available and writable |
| 168 | +4. systemd is available on the host |
| 169 | + |
| 170 | +For Sysbox issues, see: https://github.com/nestybox/sysbox |
0 commit comments