Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid type in docker-compose volume

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!

like image 643
Nicolas Avatar asked Apr 26 '17 08:04

Nicolas


1 Answers

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

like image 195
Nicolas Avatar answered Nov 09 '22 02:11

Nicolas