简体   繁体   English

错误:撰写文件“./docker-compose.yml”无效,因为:services.jenkins.networks 包含无效类型

[英]ERROR: The Compose file './docker-compose.yml' is invalid because: services.jenkins.networks contains an invalid type

ERROR: The Compose file './docker-compose.yml' is invalid because: services.jenkins.networks contains an invalid type, it should be an array, or an object错误:Compose 文件 './docker-compose.yml' 无效,因为:services.jenkins.networks 包含无效类型,它应该是数组或 object

version: '3'
services:
  jenkins:
    container_name: jenkins
    image: jenkins
    ports:
      - "8080:8080"
    volumes:
      - "$PWD/jenkins_home:/var/jenkins_home"
    networks:
      -net
networks:
  net:

Docker-Compose - 1.26.0, build d4451659 || Docker-Compose - 1.26.0,构建 d4451659 || Jenkins for docker - Official Image || Jenkins 用于 docker - 官方图片 || Linux Type - Cent-OS 7 minimal launched on AWS Linux 类型 - 在 AWS 上推出的 Cent-OS 7 最小版本

try a space at line 11: - net instead of -net在第 11 行尝试一个空格:-net 而不是 -net

using aliases would make your life easier.使用别名会让你的生活更轻松。

version: '3.5'
services:

      jenkins-server:
    .
    .
    .
        networks:
          jenkins:
            aliases:
              - jenkins

at the bottom of the file making the network external would also keep the network when you do docker-compose down:在文件的底部,当您执行 docker-compose 时,将网络设为外部也会保留网络:

networks:
  jenkins:
    external: true

@aiman09 is also right about the space. @aiman09 关于空间也是正确的。 Yml is very rigid with spaces. Yml 对空格非常严格。

暂无
暂无

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

相关问题 docker-compose 显示所有不是在 docker-compose.yml 中定义的服务 - docker-compose displaying all services not the one defined in docker-compose.yml AWS ECS-CLI docker-compose.yml depends_on 错误“services.nginx.depends_on.0 必须是字符串” - AWS ECS-CLI docker-compose.yml depends_on error "services.nginx.depends_on.0 must be a string" 如何从AWS中的开发docker-compose.yml转到已部署的docker-compose.yml - how to go from development docker-compose.yml to deployed docker-compose.yml in aws 我如何真正将 docker-compose.yml 部署到云端? - How do I really deploy docker-compose.yml to the cloud? AWS Elastic Beanstalk 不支持 docker-compose.yml 吗? - is docker-compose.yml not supported in AWS Elastic Beanstalk? 在AWS ECS中使用docker-compose.yml和ecs-params.yml文件以不同的Lauch类型和卷安装来运行多个任务定义 - Run multiple task-definition using docker-compose.yml and ecs-params.yml file in AWS ECS with different lauch type and volume mounting 如何在 AWS Elastic Container Service 中使用现有的 docker-compose.yml 文件? - How to use existing docker-compose.yml file in AWS Elastic Container Service? AWS Elastic Beanstalk 与 AMI2 和 docker-compose.yml - AWS Elastic Beanstalk with AMI2 and docker-compose.yml 每个 docker 撰写 yml 文件是否与 AWS ECS 容器兼容 - Does every docker compose yml file is compatible with AWS ECS containers 将 Docker-Compose YML 部署到 AWS ECS - Deploy Docker-Compose YML to AWS ECS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM