【发布时间】:2019-12-03 14:25:07
【问题描述】:
鉴于以下 docker-compose.yml 设置:
version: '3.7'
services:
reverse:
container_name: nginx-reverse-proxy
hostname: nginx-reverse-proxy
image: nginx:stable
ports:
- 80:80
- 433:433
volumes:
- type: bind
source: ./config
target: /etc/nginx
consistency: consistent
这导致./config 文件夹被映射到容器nginx-reverse-proxy,因此在容器内的一个空的/etc/nginx 目录中。
目标:
将文件夹从容器映射到主机。在我的示例中 from 容器 /etc/nginx to 主机 ./config。
我当前的搜索不断导致将目录从主机映射到容器(我不想要)。
感谢任何提示/解决方案。谢谢!
我目前的解决方案很丑:
我用 docker 创建了容器,并将文件从/etc/nginx 复制到./config。移除容器并使用 docker-compose up 有效,nginx 启动,因为所需的文件已经在主机上。
编辑:创建时该文件夹不存在。 Docker compose 正在按照文档中的说明创建文件夹。
【问题讨论】:
标签: docker docker-compose