This opinionated bash script automates the creation of Alpine Linux LXC containers on Proxmox with Docker, Tailscale, and development tools pre-installed.
- Automated Alpine Linux LXC creation with latest template
- Docker & Docker Compose pre-installed and configured
- Tailscale VPN support with kernel configuration
- Oh My Posh with Atomic theme and Nerd Fonts
- Development tools: git, vim, ansible, mosh, etc.
- Custom MOTD with system information
- Email notifications for unattended installations
- Flexible configuration via external config file
- High availability and backup ready
- Proxmox VE 7.x or 8.x
- Root access on Proxmox host
- Internet connection for package downloads
- Python3 (for email notifications)
- Sufficient storage and resources
- Copy the script to your Proxmox host:
wget https://git.gadgetboy.org/Homelab/create-alpine-lxc/raw/branch/main/create-alpine-lxc.sh
chmod +x create-alpine-lxc.sh- Review the script then run it once to generate the configuration file:
./create-alpine-lxc.sh- Edit the configuration file:
nano create-lxc.conf- Run the script again to create your container:
./create-alpine-lxc.sh| Variable | Description | Default |
|---|---|---|
attended |
Interactive (1) or unattended (0) mode | 1 |
hostname |
Container hostname | alpine-docker |
vmid |
Container ID (empty for auto) | "" |
root_password |
Root password | changeme123 |
tags |
Proxmox tags | alpine;docker |
| Variable | Description | Default |
|---|---|---|
cpu |
Number of CPU cores | 2 |
ram |
RAM in MB | 2048 |
swap |
Swap in MB | 512 |
disk |
Root disk size in GB | 32 |
storage |
Storage pool name | local |
| Variable | Description | Default |
|---|---|---|
bridge |
Network bridge | vmbr0 |
ssh_public_key |
SSH public key for root | "" |
| Variable | Description | Default |
|---|---|---|
smtp_enabled |
Enable email notifications | 0 |
smtp_server |
SMTP server address | smtp.gmail.com |
smtp_port |
SMTP port | 587 |
smtp_user |
SMTP username | "" |
smtp_password |
SMTP password | "" |
- Alpine Linux (latest)
- Bash & Bash completion
- Core utilities (curl, wget, git, vim, nano, htop)
- Python 3 & pip
- Docker CE
- Docker Compose
- Container networking support
- Tailscale VPN
- Dropbear SSH server
- OpenSSH client
- Mosh (mobile shell)
- Ansible
- Git
- Oh My Posh (modified Atomic theme)
- JetBrains Mono Nerd Font
- Various text editors
The container displays a custom message of the day showing:
- ASCII art hostname
- LAN IP address
- Tailscale hostname and status
- System information
The Atomic theme provides:
- Git status integration
- Execution time tracking
- Multiple programming language indicators
- Battery status (if applicable)
- Current time display
- Docker daemon auto-starts on boot
- Nesting enabled
- Proper cgroup configuration
- Kernel modules configured
- TUN device support
- Ready for
tailscale upcommand
-
Enter the container:
pct enter <VMID>
-
Configure Tailscale:
tailscale up
-
Test Docker:
docker run hello-world
-
Check the configuration report:
cat /opt/<hostname>_*_report.txt
- Change the default root password immediately (or in the create-lxc.conf before script execution)
- Configure SSH key authentication
- Consider disabling password authentication
- Set up nominal firewall rules
- Keep the system updated
- Check Proxmox logs:
journalctl -u pve-container@<VMID> - Check storage allocation
- Check if VMID is already in use
- Verify bridge configuration
- Check DHCP server availability
- Ensure firewall allows container traffic
- Verify nesting is enabled in container options
- Check Docker daemon logs:
docker logs - Ensure cgroup configuration is correct
- Check if TUN device exists:
ls /dev/net/tun - Verify kernel module:
lsmod | grep tun - Check Tailscale logs:
tailscale status
Use different storage for different components:
storage="local" # For root filesystem
template_storage="local" # For templatesConfigure HA in a Proxmox cluster:
# In create-lxc.conf (uncomment and configure)
ha_enabled=1
ha_group="ha-group-1"Feel free to submit issues, fork the repository, and create pull requests for any improvements.
This script is provided as-is without warranty. Use at your own risk.
Always test in a non-production environment first!
- Proxmox Team
- Alpine Linux maintainers
- Jan De Dobbeleer, creator of Oh My Posh