AgentSkillsCN

docker-deployment

使用 Docker 容器部署,同时配置 Nginx HTTPS 证书,并集成 Cloudflare Tunnel。适用于使用 Docker 部署 Web 应用程序、配置 SSL/TLS 证书、设置 Nginx 反向代理,或通过 Cloudflare Tunnel 实现安全的外部访问时使用。

SKILL.md
--- frontmatter
name: docker-deployment
description: Docker container deployment with Nginx HTTPS configuration and Cloudflare Tunnel integration. Use when deploying web applications with Docker, configuring SSL/TLS certificates, setting up Nginx reverse proxy, or integrating with Cloudflare Tunnel for secure external access.
license: MIT

Docker Deployment with Nginx HTTPS

Quick Start

For Docker web application deployment with HTTPS support:

  1. Configure Nginx with SSL certificates (see nginx-https.md)
  2. Set up docker-compose.yml with certificate volume mounting
  3. Configure Cloudflare Tunnel to connect external domain to local container

Common Tasks

TaskReference
Nginx HTTPS configurationnginx-https.md
Cloudflare Origin Certificatecf-origin-cert.md
Docker data persistencedata-persistence.md
Cloudflare Tunnel setupcf-tunnel.md

Architecture Overview

code
Internet → Cloudflare Edge (HTTPS) → Cloudflare Tunnel → Ubuntu/Docker (Nginx)

Key Principles

  • Always use named Docker volumes for persistent data
  • Nginx should redirect HTTP (80) to HTTPS (443) in production
  • Cloudflare Origin Certificates are for CF-to-origin encryption only
  • Tunnel connects to HTTP or HTTPS - configure based on nginx setup

Troubleshooting

HTTPS not working after enabling Cloudflare force HTTPS?

  • Check if nginx listens on port 443
  • Verify SSL certificates are mounted correctly
  • Ensure Cloudflare Tunnel service URL matches (http:// or https://)

Data lost after container restart?

  • Check docker-compose.yml uses named volumes, not bind mounts for critical data
  • Verify database path points to mounted volume directory

See individual reference files for detailed solutions.