【问题标题】:Docker compose file version compatibility errorDocker compose 文件版本兼容性错误
【发布时间】:2021-03-03 21:39:13
【问题描述】:

我有版本 20.10.5 的 docker 引擎

Docker version 20.10.5, build 55c4c88

和 docker-compose 版本 1.23.2

docker-compose version 1.23.2, build 1110ad01

在 ubuntu 版本 20.04 上

Linux ed 5.4.0-66-generic #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

当我尝试对 3.8 版本的文件使用 docker-compose 命令时,它会报错。

ERROR: Version in "./jenkins.docker-compose.yml" is unsupported. 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.

如果我更改为 3.7 版,它可以工作。 Docker 文档提到版本 3.8 应该与 docker engine 19.03.0+ 一起使用

version: '3.8'
services:
  jenkins:
    build: .  
    image: jenkins:lts
    container_name: jenkins
    privileged: true
    restart: always
    ports:
      - "50000:50000"
      - "8080:8080"
    networks:
      - ed 
    volumes:
      - jenkins-log:/var/log/jenkins
      - jenkins-data:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - ./downloads:/var/jenkins_home/downloads
      - /usr/bin/docker:/usr/bin/docker
    environment:
      - VIRTUAL_HOST=jenkins.ed.tech
      - VIRTUAL_PORT=8080
        #- SSH_AUTH_SOCK=/ssh-agent
volumes:
  jenkins-data:
  jenkins-log:
networks:
  default:
    external:
      name: ed

我错过了什么?

【问题讨论】:

    标签: docker ubuntu docker-compose


    【解决方案1】:

    您的docker-compose 版本不支持撰写版本 3.8。您需要至少更新到 docker-compose 版本 1.25.5:https://github.com/docker/compose/releases/tag/1.25.5

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多