Compose: docker-compose ps fails for version 2.0 of compose yml

Created on 9 Feb 2016  路  20Comments  路  Source: docker/compose

The error message ist: In file './common.yml' service 'version' doesn't have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.

areconfig

Most helpful comment

I don't think this is an issue with ps, the config is failing validation.

What version of docker-compose are you using? Version 2 is only supported by compose 1.6.

If you're using 1.6, please provide a sample of docker-compose.yml and common.yml.

All 20 comments

I don't think this is an issue with ps, the config is failing validation.

What version of docker-compose are you using? Version 2 is only supported by compose 1.6.

If you're using 1.6, please provide a sample of docker-compose.yml and common.yml.

I did have the same problem.
Was working on Mac but not on Linux.

$ docker version
Client:
 Version:      1.10.0
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   590d5108
 Built:        Thu Feb  4 18:36:33 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.10.0
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   590d5108
 Built:        Thu Feb  4 18:36:33 2016
 OS/Arch:      linux/amd64

docker-compose was simply not at the latest version although the docker package was up to date :

$ docker-compose --version
docker-compose version: 1.5.1

docker-compose is not installed as part of the docker-engine package, see https://docs.docker.com/compose/install/

@dzwicker please provide an example of the config file you're using, and the output of docker-compose version

I've been struggling with the same issue but @dnephin just saved my time.

I'd recommended that upgrade docker-compose to version ^1.6. It will solve this issue.

Also for me this was due to running docker-compose version 1.5.2. Updating to 1.7 fixed it

I have the same issue as above. I've checked my docker-compose version and it is 1.5.2. I tried upgrading it but it says it is the latest version. Does that mean docker-compose on ubuntu cannot handle version 2?

I installed from https://github.com/docker/compose/releases and my problem was resolved. on 1.8 now.

I have the same issue even after upgrading the docker-compose from 1.5.x to 1.8.1.

My docker-compose version command gives the following output

docker-compose version 1.8.1, build 878cff1

I have same Issue with version 1.12

$ docker-compose build
ERROR: In file './docker-compose.yml' service 'version' doesn't have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.

$ date
mar nov 29 09:20:13 CET 2016

$ docker version
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.6.2
Git commit: 23cf638
Built: Tue, 27 Sep 2016 12:25:38 +1300
OS/Arch: linux/amd64

$ cat docker-compose.yml
version: '2'
services:
db:
image: postgres
web:
build: .
command: bundle exec rails s -p 3008 -b '0.0.0.0'
ports:
- '3008:3008'
depends_on:
- db

@ismael74 what's the output of docker-compose version?

$ docker-compose version
docker-compose version 1.5.2, build unknown
docker-py version: 1.8.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016

@ismael74 Version 2 of the file format is only supported by Compose 1.6+.

Look at this thread, I following this article and it works fine for me in ubuntu 16.04 LTS
https://docs.docker.com/compose/install/#/alternative-install-options
I just updated by github.

Suddenly getting this error from my CI since 1.10 was released. 1.9 works fine.

Fixed, was unrelated

MisterGlass, what was the fix for your CI. I'm now getting this error from CircleCI, which is running docker-compose 1.10.

@billwright We were doing the pip install with sudo, which caused issues. This thread might help you https://github.com/docker/compose/issues/4349

Thanks for the response. My solution was to change this line in my circleci.yml from this:

- sudo pip install docker-compose

to this:

- sudo pip install docker-compose==1.8.1

Apparently version 1.9 and above have a bug concerning version 2.0 yml files.

@billwright thanks, that worked for me as well. Why oh why do I put myself through the horrible pain of running tests through docker-compose? :(

Was this page helpful?
0 / 5 - 0 ratings