
---
#领域/未知

#复盘/0 #临时/备忘 #状态/待处理

20260302-备忘-主题名-文件内容

## 一句话描述

[____docker compose 可以depends on前置处理任务____]

---


```yml
version: '3'

services:
  # 第一步：初始化卷权限（只运行一次）
  init-permissions:
    image: busybox
    volumes:
      - vikunja_files:/app/vikunja/files
      - vikunja_db:/app/vikunja/db
    command: >
      sh -c "chown -R 1000:0 /app/vikunja && chmod -R 775 /app/vikunja"
    user: root

  # 第二步：启动Vikunja（依赖权限初始化完成）
  vikunja:
    image: vikunja/vikunja:latest
    container_name: vikunja
    ports:
      - "3456:3456"
    volumes:
      - vikunja_files:/app/vikunja/files
      - vikunja_db:/app/vikunja/db
    environment:
      - VIKUNJA_SERVICE_JWTSECRET=$(openssl rand -hex 32)  # 自动生成随机密钥
      - VIKUNJA_DATABASE_TYPE=sqlite
      - VIKUNJA_DATABASE_PATH=/app/vikunja/db/vikunja.db
      - VIKUNJA_SERVICE_FRONTENDURL=http://你的服务器IP:3456/  # 替换为你的IP
    user: "1000:0"  # 匹配卷权限
    restart: unless-stopped
    depends_on:
      - init-permissions  # 确保先初始化权限

volumes:
  vikunja_files:
  vikunja_db:

```


https://github.com/go-vikunja/vikunja/releases/tag/v2.1.0



