简体   繁体   English

错误:撰写文件“./docker-compose.yml”无效,因为:服务不支持的配置选项:“sqlite3”

[英]ERROR: The Compose file './docker-compose.yml' is invalid because: Unsupported config option for services: 'sqlite3'

webapp:
  build: ./webapp
  ports:
   - "5000:5000"
  volumes:
   - .:/code

services:
  sqlite3:
    image: nouchka/sqlite3:latest
    stdin_open: true
    tty: true
    volumes:
      - ./db/:/Users/vijayraghunath/Desktop/assignment/webapp

Above is my docker-compose.yml file.上面是我的 docker-compose.yml 文件。 When I try to launch the Python Flask web application by the command,当我尝试通过命令启动 Python Flask Web 应用程序时,

docker-compose up --build 

it gives the error as in the title.它给出了标题中的错误。 I am using the sqlite db.我正在使用 sqlite 数据库。

You've merged the version 1 (deprecated) syntax when you don't include a version line, with the version 2 syntax that moved services under a services top level.当您不包含版本行时,您已将版本 1(已弃用)语法与将服务移动到services顶层下的版本 2 语法合并。 You need to pick one syntax or the other, you can't parse both simultaneously.您需要选择一种语法,不能同时解析两者。

Here's the version 2 syntax:这是版本 2 的语法:

version: '2'

services:
  sqlite3:
    image: nouchka/sqlite3:latest
    stdin_open: true
    tty: true
    volumes:
     - ./db/:/Users/vijayraghunath/Desktop/assignment/webapp
  webapp:
    build: ./webapp
    ports:
     - "5000:5000"
    volumes:
     - .:/code

Note, be careful with spacing in the file since yaml is white space sensitive.请注意,请注意文件中的间距,因为 yaml 对空格敏感。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM