【问题标题】:I am working on a php docker application.Am facing an error while trying docker-compose up command我正在开发一个 php docker 应用程序。在尝试 docker-compose up 命令时遇到错误
【发布时间】:2022-01-11 23:45:12
【问题描述】:

我的 docker-compose.yml 文件

version: "3.9"
services:
    web:
    build: .
    ports:
        - "5000:5000"
redis:
   image: "redis:alpine"

我的错误:

ERROR: In file './docker-compose.yml', service 'build' must be a mapping not a string.

【问题讨论】:

    标签: java linux docker docker-compose dockerfile


    【解决方案1】:
    • 确保您没有使用 TAB,而只是使用 SPACE(YAML 不支持 TABS)

    • 另外,您的 YAML 文件中的缩进错误:

    应该是:

    version: "3.9"
    services:
      web:
        build: .
        ports:
         - "5000:5000"
      redis:
        image: "redis:alpine"
    

    【讨论】:

    • 非常感谢,它正在工作
    • 乐于助人!请将其标记为解决方案,以帮助其他人了解这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 1970-01-01
    • 1970-01-01
    • 2019-11-16
    • 2021-10-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多