我尝试在bind
中设置docker-compose
卷,但收到以下错误:
docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.web.volumes contains an invalid type, it should be a string
我的docker-compose
文件:
version: '3'
services:
web:
#build: .
image: fnndsc/fnndsc.babymri.org
ports:
- "8060:8080"
volumes:
- type: "bind"
source: "."
target: "/src/website"
labels:
name: "FNNDSC Web App"
role: "FNNDSC Web App development server"
版本:
Docker版本17.03.1-ce,构建c6d412e
docker-compose版本1.12.0,build b31ff33
我尝试了许多不同的组合,但似乎没有任何效果......
谢谢!
答案 0 :(得分:8)
扩展表示法需要版本3.2:
version: '3.2'
services:
web:
#build: .
image: fnndsc/fnndsc.babymri.org
ports:
- "8060:8080"
volumes:
- type: bind
source: .
target: /src/website
labels:
name: "FNNDSC Web App"
role: "FNNDSC Web App development server"
参考:https://github.com/docker/compose/issues/4763#issuecomment-297509279
答案 1 :(得分:0)
试试这个:
version: '3'
services:
web:
#build: .
image: fnndsc/fnndsc.babymri.org
ports:
- "8060:8080"
volumes:
- .:/src/website
labels:
name: "FNNDSC Web App"
role: "FNNDSC Web App development server"