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)

3. Security Settings (DISABLE)

4. Storage and Network

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

7. Post-Setup Steps

  1. Access Portainer:

    https://<LXC-IP>:9000
    
  2. Add Stack:

    • Navigate to the "Stacks" section in Portainer.
    • Add a new stack and deploy docker-compose.yml with 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:

  1. Create a docker-compose.yml file:

    vi docker-compose.yml
    
  2. Deploy using Docker Compose:

    docker-compose up -d
    
  3. Access Services:

    • Web service: http://<LXC-IP>:8080
    • Database service: Connect via the appropriate database client.

Next Steps

  1. Install Docker on Proxmox LXC Container:

    apt-get update && apt-get install docker.io
    
  2. Start and Enable Docker Service:

    systemctl start docker
    systemctl enable docker
    
  3. Verify Docker Installation:

    docker --version
    
  4. Run a Simple Docker Container:

    docker run -d --name my_web_server nginx
    
  5. Access the Web Server:

    • Visit http://<LXC-IP>:80 in your browser.

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.

Reference