sixeyed / diamol

Code samples for the book "Learn Docker in a Month of Lunches"
https://www.manning.com/books/learn-docker-in-a-month-of-lunches
Creative Commons Attribution Share Alike 4.0 International
496 stars 261 forks source link

Chapter 14: unsupported Compose file version: 1.0 #42

Open crimsonread opened 2 years ago

crimsonread commented 2 years ago

Exercise CH14

Problem When I run docker stack deploy -c stack.yml numbers The output is unsupported Compose file version: 1.0

Docker version Client: Cloud integration: v1.0.22 Version: 20.10.12 API version: 1.41 Go version: go1.16.12 Git commit: e91ed57 Built: Mon Dec 13 11:44:07 2021 OS/Arch: windows/amd64 Context: default Experimental: true

Server: Docker Engine - Community Engine: Version: 20.10.12 API version: 1.41 (minimum version 1.12) Go version: go1.16.12 Git commit: 459d0df Built: Mon Dec 13 11:43:56 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.12 GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d runc: Version: 1.0.2 GitCommit: v1.0.2-0-g52b36a2 docker-init: Version: 0.19.0 GitCommit: de40ad0

Code version Latest version

mikejwhat commented 2 years ago

This took me ages to figure out. It’s because the docker compose config command supports the new ‘compose specification’, therefore it omits the version declaration at the top of the file - however docker stack deploy does not support it and still requires you specify the version (fix = make sure you add the version to the top of the compose file (i.e “version”: “3.8”))

brian4ko commented 1 year ago

thanks for posting this. I also got the same error. I was able to get past it by adding that line and also removing the beginning line "name: numbers". Third step was to remove quotation marks around "80" in the ports section.