我有一个yml文件,其配置可以运行两个容器。这是文件:
web:
build: ./web
ports:
- "8000:8000"
restart: always
volumes:
- website:/www/
nginx:
build: ./nginx
ports:
- "80:80"
restart: always
links:
- web
volumes:
- website:/www/
volumes:
website:
当我运行此操作时,我总是会收到以下错误:
The Compose file '.\docker-compose.yml' is invalid because:
Unsupported config option for volumes: 'website'
我用谷歌搜索了这个,我觉得这很好,就像现在一样。这有什么问题?
答案 0 :(得分:0)
我认为你应该在docker-compose文件中添加version
和services
。
version: '3'
services:
web:
build: ./web
ports:
- "8000:8000"
restart: always
volumes:
- website:/www/
nginx:
build: ./nginx
ports:
- "80:80"
restart: always
links:
- web
volumes:
- website:/www/
volumes:
website: