【发布时间】:2017-11-06 22:30:52
【问题描述】:
我的 docker-compose 定义了两个容器。我希望一个容器与另一个容器共享一个卷。
version: '3'
services:
web-server:
env_file: .env
container_name: web-server
image: web-server
build:
dockerfile: docker/Dockerfile
ports:
- 3000:3000
- 3500:3500
volumes:
- static-content: /workspace/static
command: sh /workspace/start.sh
backend-server:
volumes:
- static-content: /workspace/static
volumes:
static-content:
上面的 docker composer 文件声明了两个服务,web-server 和 backend-server。我在服务下声明了命名卷static-content。运行docker-composer -f docker-composer.yml up时出现以下错误:
services.web-server.volumes contains an invalid type, it should be a string
services.backend-server.volumes contains an invalid type, it should be a string
那么如何共享卷投掷 docker-composer?
【问题讨论】:
标签: docker docker-compose