nginx 坞站组成0x5000:不是目录:unknown:您是否尝试将目录挂载到文件上(反之亦然)?

o4hqfura  于 2023-01-25  发布在  Nginx
关注(0)|答案(1)|浏览(1236)

我正在尝试获取一个配置文件并替换nginx中已经存在的默认. conf。
我的超级简单的Docker组成:

version: '3.3'
services:
  qwc-api-gateway:
    image: nginx:1.19
    volumes:
      - ./default.conf:/etc/nginx/conf.d/default.conf

为了方便起见,我甚至在这里发布了这两个文件:https://github.com/Xentraxx/qwc-docker
问题是:如果我尝试在portainer中从这个存储库构建一个堆栈,它会失败,并显示错误消息:

Error response from daemon: 
failed to create shim: 
OCI runtime create failed: 
runc create failed: 
unable to start container process:
error during container init: 
error mounting "/data/compose/7/default.conf" to rootfs at "/etc/nginx/conf.d/default.conf": 
mount /data/compose/7/default.conf:/etc/nginx/conf.d/default.conf (via /proc/self/fd/6), 
flags: 0x5001: 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

如果我在本地运行docker-compose up -d,容器将启动,并且我可以在日志中看到default.conf具有我想要的值。
我在网上找不到任何有用的东西,只有一些人说源文件可能不存在。所以请随意使用我的存储库,尝试在Portainer中创建一个堆栈,然后让我知道我做错了什么。因为我再也不知道了。
另外,请忽略容器在启动后崩溃。这是不相关的。

kmpatx3s

kmpatx3s1#

我在使用gitlab-runner时也遇到了同样的问题,我使用的是dind,解决方案是共享将在容器之间挂载的文件夹:在gitlab-runner和带插座的docker-with-socket容器之间:
在x1月1x

...
volumes = ["/cache","/opt"]
...

如果你犯了错
安装“/data/compose/7/默认.conf”时出错
你应该共享/data文件夹。

相关问题