[英]Docker compose yaml - Volumes issue
I've been following this docker tutorial , but because it's really out of date today, I cannot completely follow it. 我一直在关注此Docker教程 ,但是由于它实际上已经过时,所以我无法完全关注它。 Once I had this
docker-compose.yml
file working: 一旦我使这个
docker-compose.yml
文件工作了:
version: '3'
services:
nginx:
build: ./nginx/
ports:
- 80:80
links:
- php
volumes:
- ./www/html:/var/www/html
php:
image: php:7.0-fpm
expose:
- 9000
volumes:
- ./www/html:/var/www/html
It did ran successfully. 它确实运行成功。
It didn't work when I was trying to extract volumes info into the separate property volumes . 当我尝试将卷信息提取到单独的属性卷中时,此操作不起作用。
I've tried several approaches and combinations, but all have failed. 我尝试了几种方法和组合,但是都失败了。 Please give me a hint how to specify it properly.
请给我提示如何正确指定它。
Folder structure like this: 文件夹结构如下:
nginx
default.conf
Dockerfile
www
html
index.php
docker-compose.yml
Host volumes, aka bind mounts, don't need to have a separate volumes section at the top level. 主机卷(也称为绑定挂载)不需要在顶层有单独的卷部分。 The volumes section is only needed for named volumes.
卷部分仅适用于命名卷。 In fact the only way you can use the volumes top level is with a named volume.
实际上,可以使用顶级卷的唯一方法是使用命名卷。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.