Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported config option for services.volumes

Trying to setup docker for the first time and I'm running into a problem with volumes. I feel pretty confident that the spacing and formatting in the .yml is correct at this point.

I've tried versions 3, 3.1, 3.2, 3.3 and 3.4. All are getting the same error message (below)

Unsupported config option for services.volumes: 'db2_prod'

version: '3'

services:
   liberty:
     image: liberty:${liberty_tag}
     ports:
       - "${liberty_ip}:9080:9080"
       - "${liberty_ip}:9443:9443"
     restart: always

   apache:
     image: webapp:${apache_tag}
     ports:
       - "${apache_ip}:80:80"
       - "${apache_ip}:443:443"
     restart: always

   db2:
     image: db2:${db2_tag}
     ports:
       - "${db2_ip}:50000:50000"
     stdin_open: true
     tty: true
     restart: always
     volumes:
       - db2_prod:/database/stagg3

   volumes:
     db2_prod:
like image 798
Coy Avatar asked Dec 05 '17 22:12

Coy


2 Answers

volumes needs to be at the same indentation with services i.e

services:
    #...
volumes:
    db2_prod:
like image 160
stacksonstacks Avatar answered Nov 16 '22 02:11

stacksonstacks


version: '3.7'
services:
    web:
        build: .
        command: python /code/manage.py runserver 0.0.0.0:8000
        volumes:
            - .:/code
        ports:
            - 8000:8000
        depends_on:
            - db
    db:
        image: postgres:11
        volumes:
            - postgres_data:/var/lib/postgresql/data/

volumes:
    postgres_data:

observe that version, services and volumes have same indent level. Moreover use spacebar for indentation, use of tab may create problem.

like image 22
PythonDeveloper Avatar answered Nov 16 '22 04:11

PythonDeveloper