V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Exp
V2EX  ›  Docker

请问如何迁移 Nginx Proxy Manager docker 数据?

  •  
  •   Exp · 10 天前 · 488 次点击

    昨天晚上准备将搭建在家里群晖 docker 上的 NPM 迁移到 OpenWrt 路由器的 docker 中去。

    不想再一个一个重新配置域名反代解析,直接将群晖的 NPM docker 目录( docker-compose.yml 文件 和 data, letsencrypt 两个文件夹)拷贝到 OpenWrt 上去构建,发现无法启动成功。报错如下:

    PixPin_2025-02-28_10-28-59.png

    能力有限,网上搜索一些关键字没有大看明白,网上简单搜索了一下大概了解可能是跟 ssl 证书相关但不知道解决办法。

    不知有没有佬哥知道如何解决这个问题呢?核心点就是想保留之前 NPM 配置好的域名解析。

    附带 docker-compose.yml 内容如下:

    services:
      app:
        image: 'jc21/nginx-proxy-manager:latest'
        container_name: nginx-proxy-manager
        restart: unless-stopped
        ports:
          # These ports are in format <host-port>:<container-port>
          - '19654:80' # Public HTTP Port
          - '1789:443' # Public HTTPS Port
          - '2345:81' # Admin Web Port
          # Add any other Stream port you want to expose
          # - '21:21' # FTP
    
        # Uncomment the next line if you uncomment anything in the section
        environment:
          TZ: Asia/Shanghai
          # Uncomment this if you want to change the location of
          # the SQLite DB file within the container
          DB_SQLITE_FILE: "/data/database.sqlite"
    
          # Uncomment this if IPv6 is not enabled on your host
          # DISABLE_IPV6: 'true'
    
        volumes:
          - ./data:/data
          - ./letsencrypt:/etc/letsencrypt
    
    6 条回复    2025-02-28 15:42:42 +08:00
    oneisall8955
        1
    oneisall8955  
       10 天前
    你那边缺少文件,复制的 data 和 letsencrypt 目录文件完整吗,挂在的目录对了吗,修改 volumes 为绝对路径看看,或者修改--entrypoint 进去看看容器实际运行情况
    ```bash
    docker run --rm \
    --name nginx-proxy-manager \
    -p 19654:80 \
    -p 1789:443 \
    -p 2345:81 \
    -e DB_SQLITE_FILE="/data/database.sqlite" \
    -v /xxx/xxx/data:/data \
    -v /xxx/xxx/letsencrypt:/etc/letsencrypt \
    --entrypoint /bin/sh
    jc21/nginx-proxy-manager:latest
    ```

    上面 /xxx/xxx 改为你的 data 和 letsencrypt 的父目录,模拟 npm 运行环境,ls -l /etc/letsencrypt 有没有对应的文件
    Exp
        2
    Exp  
    OP
       10 天前
    @oneisall8955 感谢回复~
    data 和 letsencrypt 目录文件是完整的,我整体拷贝过去的。
    挂载路径也是相对路径:
    ```yaml
    volumes:
    - ./data:/data
    - ./letsencrypt:/etc/letsencrypt
    ```

    我再试试换成绝对路径看
    wheat0r
        3
    wheat0r  
       10 天前
    考虑一下权限有没有问题
    Exp
        4
    Exp  
    OP
       9 天前
    @oneisall8955 换成绝对路径结果也一样,进入到 docker 容器内部看了 /etc/letsencrypt/live/npm-1 下确实没有相关文件

    @wheat0r 权限改为 777 也是一样。

    再次感谢二位,不知还有没有其它尝试方向?
    wheat0r
        5
    wheat0r  
       9 天前
    @Exp 文件是链接文件吗?
    Exp
        6
    Exp  
    OP
       9 天前
    @wheat0r #5 不是
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5653 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 03:19 · PVG 11:19 · LAX 20:19 · JFK 23:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.