无法将配置目录挂载到Nextcloud Docker容器中 [英] Cannot mount Config directory in Nextcloud Docker container

查看:1320
本文介绍了无法将配置目录挂载到Nextcloud Docker容器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地创建自定义的Nextcloud配置,然后能够使用此处定义的卷将其安装到适当的文件夹中:

I'm trying to create a custom Nextcloud config locally, then have the ability to mount it to the appropriate folder using volumes as defined here: https://github.com/nextcloud/docker#persistent-data. All the volume mounts work except for the config mount... Why is that being treated differently here?

0)输入一个新的/空目录(不包含子目录或其他文件).

0) Enter a new/emptry directory (containing no sub-directories or additional files).

1)创建一个仅包含以下内容的docker-compose.yml文件:

1) Create a docker-compose.yml file containing only the below contents:

version: "3.4"

services:
  nextcloud:
    image: nextcloud:latest
    volumes:
      - "./nextcloud/custom_apps:/var/www/html/custom_apps"
      - "./nextcloud/config:/var/www/html/config"
      - "/data/nextcloud:/var/www/html/data"
      - "./themes:/var/www/html/themes"

2)docker-compose up -d

2) docker-compose up -d

工作.我应该能够在./nextcloud/config本地查看/var/www/html/config的内容,然后插入客户config.php,然后在容器内对其进行更新.

Work. I should be able to see the /var/www/html/config contents locally at ./nextcloud/config, and then insert a customer config.php, which is then updated within the container.

启动容器时出现错误,特定于 config 目录.如果删除上面的./nextcloud/config:/var/www/html/config卷安装,则容器将启动而不会出现错误.

An ERROR when bringing up the container, specific to the config directory. If I remove the ./nextcloud/config:/var/www/html/config volume mount above, then the container will start without error.

错误消息

错误:对于nextcloud无法启动服务nextcloud:OCI运行时创建失败:container_linux.go:349:启动容器进程导致"process_linux.go:449:容器初始化导致\" rootfs_linux.go:58:安装\\"/home/user/Nextcloud-test/nextcloud/config \\到rootfs \\"/var/lib/docker/overlay2/41b567141e23b16cf5e4f99f4c33703fc9a533aa5a4bef68fbba70a74842ca88/merged \\在\\"/var/lib/docker/fcaf43af4a43f4a43f4a43f4a43f4a43f4a43f4a43f4a43f4a43f4a43f4a4f43a4f4a43f4a4f4a4f4a4f4a4f4a4f4a4f4a4f4af3fffffffffffffffffffffffffffffffffffffffffbfbffffffffbfbffffbfbff/var/www/html/config \\导致\\"不是目录\\"\":未知:您是否正在尝试将目录挂载到文件上(反之亦然)?检查指定的主机路径是否存在以及是否为预期的类型 错误:启动项目时遇到错误.

ERROR: for nextcloud Cannot start service nextcloud: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\"/home/user/Nextcloud-test/nextcloud/config\\" to rootfs \\"/var/lib/docker/overlay2/41b567141e23b16cf5e4f99f4c33703fc9a533aa5a4bef68fbba70a74842ca88/merged\\" at \\"/var/lib/docker/overlay2/41b567141e23b16cf5e4f99f4c33703fc9a533aa5a4bef68fbba70a74842ca88/merged/var/www/html/config\\" caused \\"not a directory\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type ERROR: Encountered errors while bringing up the project.

服务器配置

操作系统:

操作系统:Debian GNU/Linux 10(破坏者) 内核:Linux 4.19.0-8-cloud-amd64 架构:x86-64

Server configuration

Operating system:

Operating System: Debian GNU/Linux 10 (buster) Kernel: Linux 4.19.0-8-cloud-amd64 Architecture: x86-64

nextcloud:latest(apache)

nextcloud:latest (apache)

推荐答案

我无法使用您的步骤进行复制(Ubuntu 18.04).

I could not reproduce using your steps (Ubuntu 18.04).

从这里开始依次运行docker-compose up -ddocker-compose logs,我看不到任何错误.然后,在容器上运行docker inspect时,我看到以下内容:

From here, running docker-compose up -d then docker-compose logs, I see no errors. Then, when running docker inspect on the container, I see the following:

...
"Volumes": {
    "/var/www/html": {},
    "/var/www/html/config": {},
    "/var/www/html/custom_apps": {},
    "/var/www/html/data": {},
    "/var/www/html/themes": {}
},
...

这表明安装座工作正常.

Which suggests the mount has worked without problem.

我建议您做什么:

  1. 检查目录./nextcloud/config存在并且不是文件
  2. 检查您的Docker和Docker Compose安装是最新的
  3. 尝试使用docker run -it -v ./nextcloud/config:/var/www/html/config <containername> /bin/bash运行Docker容器,以了解安装是否可以手动工作
  4. 尝试在一个最小的示例上执行相同的操作,例如入门示例
  1. Check the directory ./nextcloud/config exists and is not a file
  2. Check your Docker and Docker Compose installation is up-to-date
  3. Try running the Docker container with docker run -it -v ./nextcloud/config:/var/www/html/config <containername> /bin/bash to explore if the mount works manually
  4. Try to do the same on a minimal example such as the Getting started example

这篇关于无法将配置目录挂载到Nextcloud Docker容器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆