Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

docker - 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:
question from:https://stackoverflow.com/questions/47663458/unsupported-config-option-for-services-volumes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

services:
    #...
volumes:
    db2_prod:

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...