services.volumes不支持的configuration选项

试图设置docker第一次,我遇到了卷的问题。 我感到很自信,在.yml中的间隔和格式是正确的。

我已经试过版本3,1.1,3.2,3.3和3.4。 所有正在获取相同的错误信息(下面)

services.volumes不受支持的configuration选项:'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: 

volumes需要与services相同的缩进,即

 services: #... volumes: db2_prod: