Cannot mount Config directory in Nextcloud Docker container

痴心易碎 提交于 2020-05-12 08:07:26

问题


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?

Steps to reproduce

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

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

Expected behavior

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.

Actual behavior

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.

ERROR message

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.

Server configuration

Operating system:

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

Image

nextcloud:latest (apache)


回答1:


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

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.

What I suggest you do:

  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


来源:https://stackoverflow.com/questions/61159869/cannot-mount-config-directory-in-nextcloud-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!