docker版seafile挂载外部磁盘无效

遇到一个比较奇怪的问题,是这样的。
我的系统装在ssd上只有128G,于是想将seafile-data放在外部磁盘下。我使用docker 安装seafile,修改了docker-compose.yml seafile和db 的volumes到一个已经挂载的磁盘目录下。

问题是: seafile虽然能成功运行,但是好像并未成功映射,系统目录内存一直在增加,外部磁盘目录也未创建相应文件。

这是我的docker-compoes.yml 部分配置:

version: '2.0'
services:
  db:
    image: mariadb:10.1
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=passwd  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /opt/seafile-mysql/db:/home/luo/disk1/data/seafile-mysql  # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net

  memcached:
    image: memcached:1.5.6
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "80:80"
#     - "443:443"  # If https is enabled, cancel the comment.
    volumes:
      - /opt/seafile-data:/home/luo/disk1/data/seafile-data   # Requested, specifies the path to Seafile data persistent store.

已经在disk1下挂载相应磁盘:

mount /dev/sdb1  /home/luo/disk1
mkdir /home/luo/disk1/data/seafile-data 
mkdir /home/luo/disk1/data/seafile-mysql 

这个问题已经困扰我很久了,希望各位大神救救我。。。

1 个赞
volumes:
      - /opt/seafile-mysql/db:/home/luo/disk1/data/seafile-mysql

此处的/opt/seafile-mysql/db,指的是host中的目录。
/home/luo/disk1/data/seafile-mysql是container中的目录,你最好不要改container中的目录。

谢谢,问题已经解决:ok_hand:

怎么解决的呢…