docker-compose错误“只读文件系统”

时间:2018-11-04 18:08:37

标签: docker docker-compose

我设计了一个docker-compose.yml文件,该文件也应该适用于单个卷。...

我创建了一个RAID驱动器,该驱动器以/dataraid的形式安装到我的系统中。我可以读写系统,但是在撰写文件中使用它时,出现read-only file system错误消息..... 将音量调整到其他路径,例如/home/myname/test即可运行撰写文件。...

我不知道/dataraid是什么使其成为“只读”。

什么是权限设置组合文件需求?

错误消息:

ERROR: for db  Cannot start service db: error while creating mount source path '/dataraid/nextcloud/mariadb': mkdir /dataraid: read-only file system

撰写:

version: '3'
services:
  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - /dataraid/nextcloud/mariadb:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=PASSWORD
    env_file:
      - db.env
  redis:
    image: redis
    restart: always
  app:
    image: nextcloud:fpm
    restart: always
    volumes:
      - /dataraid/nextcloud/html:/var/www/html
    environment:
      - MYSQL_HOST=db
    env_file:
      - db.env
    depends_on:
      - db
      - redis
  web:
    build: ./web
    restart: always
    volumes:
      - /dataraid/nextcloud/html:/var/www/html:ro
    environment:
      - VIRTUAL_HOST=name.de
      - LETSENCRYPT_HOST=name.de
      - LETSENCRYPT_EMAIL=x@y.de
    depends_on:
      - app
    ports:
      - 4080:80
    networks:
      - proxy-tier
      - default
  collabora:
    image: collabora/code
    expose:
       - 9980
    cap_add:
      - MKNOD
    environment:
      - domain=name.de
      - VIRTUAL_HOST=name.de
      - VIRTUAL_PORT=9980
      - VIRTUAL_PROTO=https
      - LETSENCRYPT_HOST=name.de
      - LETSENCRYPT_EMAIL=x@y.de
      - username=            #optional
      - password=       #optional
    networks:
      - proxy-tier
    restart: always
  cron:
    build: ./app
    restart: always
    volumes:
      - /dataraid/nextcloud/html:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis
  proxy:
    build: ./proxy
    restart: always
    ports:
      - 443:443
      - 80:80
    environment:
      - VIRTUAL_PROTO=https
      - VIRTUAL_PORT=443
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - /dataraid/nextcloud/nginx-certs:/etc/nginx/certs:ro
      - /dataraid/nextcloud/nginx-vhost.d:/etc/nginx/vhost.d
      - /dataraid/nextcloud/nginx-html:/usr/share/nginx/html
      - /dataraid/nextcloud/nginx-conf.d:/etc/nginx/conf.d
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier
  letsencrypt-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    restart: always
    volumes:
      - /dataraid/nextcloud/nginx-certs:/etc/nginx/certs
      - /dataraid/nextcloud/nginx-vhost.d:/etc/nginx/vhost.d
      - /dataraid/nextcloud/nginx-html:/usr/share/nginx/html
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - proxy-tier
    depends_on:
      - proxy
networks:
  proxy-tier:

查看错误消息:

bernd@sys-dock:/dataraid/Docker-Configs/nextcloud$ docker-compose up -d
Creating network "nextcloud_default" with the default driver
Creating network "nextcloud_proxy-tier" with the default driver
Creating nextcloud_db_1 ...
Creating nextcloud_proxy_1     ... error
Creating nextcloud_db_1        ... error
Creating nextcloud_collabora_1 ...
ERROR: for nextcloud_proxy_1  Cannot start service proxy: error while creating mount source path '/dataraid/nextcloud/nginx-certs': mkdir /dataraid: read-only file system
Creating nextcloud_redis_1     ... done
Creating nextcloud_collabora_1 ... done
ERROR: for proxy  Cannot start service proxy: error while creating mount source path '/dataraid/nextcloud/nginx-certs': mkdir /dataraid: read-only file system
ERROR: for db  Cannot start service db: error while creating mount source path '/dataraid/nextcloud/mariadb': mkdir /dataraid: read-only file system
ERROR: Encountered errors while bringing up the project.

1 个答案:

答案 0 :(得分:8)

如果docker在挂载文件系统之前启动,则可能是docker引擎尝试写入父文件系统时出现问题。您可以重新启动docker守护进程以排除此情况(在systemd基本环境中为systemctl restart docker)。

如果重新启动守护程序有帮助,则可以在docker引擎和外部文件系统挂载之间添加依赖项。在systemd中,这涉及单位文件中的After=子句。例如。您可以创建一个包含以下内容的/etc/systemd/system/docker.service.d/override.conf文件:

[Unit]
After=nfs-client.target

(请注意,我不确定nfs-client.target是您的正确单位文件 文件系统,您需要检查它的安装位置。)


我最近看到的另一个问题是基于Snap的docker安装,它在另一种容器技术内部运行docker,这将阻止访问未在Snap中明确配置的路径。