Reputation: 245
I'm getting this error when I tried to docker-compose build
my docker-compose.yml file:
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.
docker version
Client: Version: 1.12.6 API version: 1.24 Go version: go1.6.3 Git commit: 78d1802 Built: Tue Jan 31 23:47:34 2017 OS/Arch: linux/amd64
Server: Version: 1.12.6 API version: 1.24 Go version: go1.6.3 Git commit: 78d1802 Built: Tue Jan 31 23:47:34 2017 OS/Arch: linux/amd64
docker --version Docker version 1.12.6, build 78d1802
docker-compose --version docker-compose version 1.5.2, build unknown
is this because the build unknown?
docker-composer.yml
version: "2"
services:
postgres:
image: postgres:9.6
volumes:
- pgdata:/var/lib/data/postgres
backend:
build: .
command: gosu app bash
volumes:
- .:/app
- pyenv:/python
links:
- postgres:postgres
ports:
- 8000:8000
volumes:
pyenv:
pgdata:
Upvotes: 1
Views: 10720
Reputation: 51738
You should install docker-compose using the official documentation https://docs.docker.com/compose/install/
If you are using linux, I have found the apt install for docker-compose shows some weird behavior. So uninstall docker-compose and reinstall it using the official documentation above.
sudo apt-get purge docker-compose
Upvotes: 0
Reputation: 14823
Try upgrading the docker-compose version. Version 2 files are supported by Compose 1.6.0+ and require a Docker Engine of version 1.10.0+.
Install latest "docker-compose" -
$ sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
$ sudo chmod +x /usr/local/bin/docker-compose
Ref- https://docs.docker.com/compose/compose-file/compose-versioning/#version-2
Upvotes: 1