DennisLi
DennisLi

Reputation: 4156

docker-compose 1.27 ERROR: Version in "./docker-compose.yml" is invalid

My docker-compose.yml is:

version: "1"
services:
  xxx:
    image: xxx:4.2.3
    container_name: xxx
    volumes:
      - /home/user/docker/conf:/home/admin/xxx/conf
    ports:
      - 7070:17070
    network_mode: "host"
[user@device docker]$ docker-compose up xxx
ERROR: Version in "./docker-compose.yml" is invalid. 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/

The version of docker-compose is :

docker-compose version 1.27.4, build 40524192

Upvotes: 0

Views: 778

Answers (1)

atline
atline

Reputation: 31574

version 1 no longer support since 1.6.x, see next:

Version 1
Compose files that do not declare a version are considered “version 1”. In those files, all the services are declared at the root of the document.
Version 1 is supported by Compose up to 1.6.x. It will be deprecated in a future Compose release.

So, you should define 2 or 3 if you use new docker-compose.

Upvotes: 1

Related Questions