Search code examples
dockerdocker-composecontainersdocker-volume

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:

Solution

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

    services:
        #...
    volumes:
        db2_prod: