Docker LXC Quick Reference (Proxmox Helper Scripts)
Docker LXC Quick Reference (Proxmox Helper Scripts)
This template provides a structured approach to setting up a Proxmox LXC container for running Docker. It ensures that all necessary configurations and services are properly set up, making the process straightforward and efficient.
1. Core Settings
| Setting | Value |
|---|---|
| CT ID | 100-999 (auto-suggest) |
| Hostname | monitoring-stack |
| OS | Ubuntu 24.04 |
| Cores | 2 |
| RAM | 2048MB |
| Swap | 512MB |
| Disk | 10GB |
| Unprivileged | YES |
| Root SSH | Use detected key |
2. Essential Features (ENABLE)
- Nesting:
- Required for running Docker inside the LXC container.
- Keyctl:
- Enables secure management of keys and secrets.
- FUSE:
- Provides file system integration, allowing Docker to mount volumes from the host.
- Container Protection:
- Ensures production safety by implementing necessary security measures.
3. Security Settings (DISABLE)
- TUN/TAP:
- Not required for basic setup.
- mknod:
- Disables device creation, reducing potential security risks.
- GPU Passthrough:
- Not needed for standard containerization tasks.
- USB Passthrough:
- Disabled to prevent unauthorized access.
4. Storage and Network
- Storage Pool:
local (dir)— NOT NFS- Ensures local storage is used, providing better performance and control over data.
- Network:
- Default bridge
- Configures the container to use the default network bridge for connectivity.
- Default bridge
- DNS:
- Default (Proxmox host)
- Uses the DNS settings of the Proxmox host for name resolution.
- Default (Proxmox host)
5. Script Command
bash bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/docker.sh)"
This command downloads and executes a script that automates the setup process, ensuring all necessary configurations are applied correctly.
6. Resource Summary
- Total Resources:
2cores2GBRAM10GBdisk
- Services:
ntfy: ~150MBBeszel: ~10MBUptime Kuma: ~200MBPortainer: ~300MB
7. Post-Setup Steps
-
Access Portainer:
https://<LXC-IP>:9000 -
Add Stack:
- Navigate to the "Stacks" section in Portainer.
- Add a new stack and deploy
docker-compose.ymlwith monitoring services.
Example Docker Compose File
version: '3'
services:
web:
image: nginx:latest
ports:
- "8080:80"
db:
image: postgres:latest
environment:
POSTGRES_PASSWORD: example
To deploy the services:
-
Create a
docker-compose.ymlfile:vi docker-compose.yml -
Deploy using Docker Compose:
docker-compose up -d -
Access Services:
- Web service:
http://<LXC-IP>:8080 - Database service: Connect via the appropriate database client.
- Web service:
Next Steps
-
Install Docker on Proxmox LXC Container:
apt-get update && apt-get install docker.io -
Start and Enable Docker Service:
systemctl start docker systemctl enable docker -
Verify Docker Installation:
docker --version -
Run a Simple Docker Container:
docker run -d --name my_web_server nginx -
Access the Web Server:
- Visit
http://<LXC-IP>:80in your browser.
- Visit
Summary
This guide provides a comprehensive setup for running Docker within a Proxmox LXC container, ensuring optimal resource utilization and security. By following these steps, you can quickly set up a robust environment for monitoring and managing services using Docker and Portainer.