简体   繁体   English

如何将错误修复到我的 docker 撰写文件中

[英]How to fix error into my docker compose file

I have a some code into my docker-compose file.我的 docker-compose 文件中有一些代码。 Example below:下面的例子:

version: '3.4'

services:

  api.gw:
    image: ocelotapigw
    build:
      context: .
      dockerfile: src/OcelotApiGw/Dockerfile

  catalog.api:
    image: catalogapi
      build:
        context: .
        dockerfile: src/Services/Catalog.Api/Dockerfile

      depends_on:
        - api.gw

  identity.api:
    image: identityapi
      build:
        context: .
        dockerfile: src/Services/Identity.Api/Dockerfile

      depends_on:
        - api.gw

  eshop:
    image: eshop
    build:
      context: .
      dockerfile: src/eShop/Dockerfile

    depends_on:
      - api.gw

But when command 'docker-compose up' started I received a error: - docker-compose up ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in ".\docker-compose.yml", line 13, column 12但是当命令 'docker-compose up' 启动时,我收到一个错误: - docker-compose up ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in ".\docker-compose.yml", line 13, column 12

Help please.请帮忙。 Tell why it was happen.告诉它为什么会发生。

The syntax of docker-compose.yaml file was wrong. docker-compose.yaml文件的语法错误。

Try this尝试这个

version: '3.4'

services:

  api.gw:
    image: ocelotapigw
    build:
      context: .
      dockerfile: src/OcelotApiGw/Dockerfile

  catalog.api:
    image: catalogapi
    build:
      context: .
      dockerfile: src/Services/Catalog.Api/Dockerfile

    depends_on:
      - api.gw

  identity.api:
    image: identityapi
    build:
      context: .
      dockerfile: src/Services/Identity.Api/Dockerfile

    depends_on:
      - api.gw

  eshop:
    image: eshop
    build:
      context: .
      dockerfile: src/eShop/Dockerfile

    depends_on:
      - api.gw

NOTE: build , image and depends_on field should be aligned properly.注意: buildimagedepends_on字段应该正确对齐。

To verify syntax of docker-compose.yaml make use of docker-compose config command.要验证docker-compose.yaml的语法,请使用docker-compose 配置命令。

docker-compose -f docker-compose.yaml config

暂无
暂无

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

相关问题 如何使用 psycopg2 修复我的 docker compose 错误 - how fix my docker compose error with psycopg2 如何修复我的docker-compose.yml我得到了Rabbitmq.config是目录错误? - How do I fix my docker-compose.yml I get a rabbitmq.config is a directory error? 如何修复我的 docker-compose.yml,使用 django 安装 Mayan-EDMS 时出错 - How do I fix my docker-compose.yml , error in installing Mayan-EDMS with django 如何在docker-compose中修复Jedis中的拒绝连接错误? - How to fix connection refused error in Jedis in docker-compose? 启动我的 docker-compose 文件时出现数据库访问错误 - Database access error while starting my docker-compose file 如何将我的 docker compose 文件连接到本地主机数据库 - How to connect my docker compose file to localhost databse 如何在我的docker-compose.yml文件中指定服务,该服务在docker hub中具有自己的docker-compose.yml文件? - How to specify a service in my docker-compose.yml file that has its own docker-compose.yml file in docker hub? Jenkins 中的 Docker-compose 错误“docker-compose:没有这样的文件或目录” - Docker-compose error in Jenkins "docker-compose: No such file or directory" 如何修复我的 docker-compose.yml? - 预期的<block end> , 但发现 &#39;<block mapping start> &#39; - How do I fix my docker-compose.yml? - expected <block end>, but found '<block mapping start>' docker 撰写 env_file 在我的撰写文件中不起作用 - docker compose env_file not working inside my compose file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM