将配置文件装入容器时出错 [英] Error mounting a config file into the container

查看:113
本文介绍了将配置文件装入容器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我在Windows上。

我正在尝试docker-compose。我知道我应该使用Dockerfile将文件复制到容器中,但是我想通过挂载文件来解决该问题,因为这对于我的实验来说现在比较容易。我也想以此作为对这里问题的学习经验。

I am experimenting with docker-compose. I know that I should use a Dockerfile to copy a file into the container, but I want to solve it by mounting the file because that is easier at the moment for my experiments. I also want to take this as a learning experience on what the issue is here.

我的 docker-compose.yml 看起来像这样:

version: "3"
services:
  webserver:
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - ./webapp.conf:/etc/nginx/conf.d/default.conf
  webapp:
    image: wordpress:php7.1-fpm

运行时 docker-compose up 我看到以下错误消息:

when running docker-compose up I see the following error message:

PS C:\Users\daniel\Documents\Docker> docker-compose up
Removing docker_webserver_1
Recreating ed1b21e6939c_docker_webserver_1
docker_webapp_1 is up-to-date

ERROR: for webserver  Cannot start service webserver: error while creating mount source path '/C/Users/daniel/Documents/Docker/webapp.conf': mkdir /C/Users/daniel/Documents: permission denied
ERROR: Encountered errors while bringing up the project.

我在做什么错了。

推荐答案

(我在几分钟前添加了相同的问题。)

(I added the same problem few minutes ago.)

确保您的泊坞窗允许挂载目录 C:\用户\ [已编辑] \文档\Docker

Make sure your docker is allowed to mount the directory C:\Users\[redacted]\Documents\Docker

在Windows客户端中,您可以配置docker以允许在特定驱动器上进行读取/写入。这应该可以解决您的权限问题。

In the Windows client, you can configure the docker to allow read/write on specific drives. This should fix your permissions problem.

对于我来说,它已被选中。我取消选中并再次检查了驱动器。应用更改。它提示我输入Windows密码(已更改),然后挂载再次起作用。

In my case, it was already selected. I unchecked and checked the drive again. Apply the "change". It prompted me for my Windows password (which had change) and than the mount worked again.

这篇关于将配置文件装入容器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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