Skip to content

How to achieve permanent data deployment #995

@renshinijiuhao

Description

@renshinijiuhao

Here is the Kutt I deployed using Docker Composer. After running it, I added a few URLs, deleted the container, and recreated it. As a result, the previous data was lost. This is different from my other containers. After deploying my other containers, the data is still there. I want to know where the problem lies? How to solve it?

services:
  kutt:
    image: kutt/kutt:latest
    container_name: kutt
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      # 数据库配置 - 使用现有的 MariaDB
      DB_HOST: mariadb          # 或你的 MariaDB 容器 IP/主机名
      DB_PORT: 3306
      DB_NAME: kutt             # 确保 MariaDB 中已创建此数据库
      DB_USER: kutt             # 替换为你的 MariaDB 用户名
      DB_PASSWORD: kutt12356789 # 替换为你的 MariaDB 密码
      
      # Redis 配置 - 使用现有的 Redis
      REDIS_HOST: redis         # 或你的 Redis 容器 IP/主机名
      REDIS_PORT: 6379
      REDIS_PASSWORD:  # 如果没有密码,留空或删除
      
      # Kutt 应用配置
      SITE_NAME: Kutt
      DEFAULT_DOMAIN: kutt.sua1.tk  # 替换为你的域名
      JWT_SECRET: sua111020  # 生成随机字符串
      MAIL_HOST: smtp.qq.com             # 如需邮件功能,配置 SMTP
      MAIL_PORT: 465
      MAIL_USER: [email protected]
      MAIL_PASS: hylssqhjdfhjiwqcb
      MAIL_FROM: [email protected]
      DISALLOW_REGISTRATION: "false"
      DISALLOW_ANONYMOUS_LINKS: "false"
    volumes:
      - ./custom:/kutt/custom
      # 持久化上传的文件(如自定义短链图标等)
      - ./data/uploads:/usr/src/app/uploads
      
      # 持久化日志
      - ./data/logs:/usr/src/app/logs
    networks:
      mynet:
        ipv4_address: 172.21.0.8

networks:
  mynet:
    external: true              # 使用已存在的外部网络​

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions