首页 > 解决方案 > docker-compose up -d 不运行

问题描述

码头工人版本: docker --version Docker version 20.10.6, build 370c289

Docker 撰写版本:docker-compose -v docker-compose version 1.29.2, build 5becea4c

我的 docker-compose.yaml 文件

version: '3'
sevices:
  jenkins:
    container_name: jenkins
    image: docker.io/jenkins 
    ports:
      - "8080:8080"
    volumes:
      - "/home/jenkins/jenkins-data/jenkins_home:/var/jenkins_home"
    network:
      - net
networks:
  net:

错误:

[jenkins@jenkins jenkins-data]$ docker-compose up -d
ERROR: The Compose file './docker-compose.yaml' is invalid because:
'sevices' does not match any of the regexes: '^x-'

You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
[jenkins@jenkins jenkins-data]$ 

已经尝试将 docker-compose.yaml 文件中的版本更改为 3.1、3.2、1.29

标签: dockerdocker-compose

解决方案


您在第 2 行的服务中缺少 r


推荐阅读