17

I try to setup a bind volume in my docker-compose but I get the following error:

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

My docker-compose file:

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"

Versions:

Docker version 17.03.1-ce, build c6d412e

docker-compose version 1.12.0, build b31ff33

I tried many different combinations but nothing seems to work...

Thanks!

G.S
  • 10,413
  • 7
  • 36
  • 52
Nicolas
  • 2,191
  • 3
  • 29
  • 49

2 Answers2

29

Version 3.2 is required for the extended notation:

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"

Reference: https://github.com/docker/compose/issues/4763#issuecomment-297509279

Nicolas
  • 2,191
  • 3
  • 29
  • 49
0

Try this:

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"
kstromeiraos
  • 4,659
  • 21
  • 26