docker-compose config
has a reversion in the 1.27 release. The output strips the minor version number and removes quote marks for cpu limits and ports. This turns a valid input file into invalid output, so it can't be deployed as a stack in Swarm mode.
This is an issue because you can't join multiple Compose files together for a stack deploy, so you use config
to join all your overrides into a single stack file to deploy. I guess this will break a lot of pipelines (and the exercises in chapter 14 of Learn Docker in a Month of Lunches).
Output of docker-compose version
PS>docker-compose version
docker-compose version 1.27.0, build 980ec85b
docker-py version: 4.3.1
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
Input:
PS>cat .\docker-compose.yml
version: "3.7"
services:
nginx:
image: nginx
deploy:
resources:
limits:
cpus: "0.75"
Output from 1.27:
PS>docker-compose config
services:
nginx:
deploy:
resources:
limits:
cpus: 0.75
image: nginx
version: '3'
Version 3.7 has become version 3, and the cpu has lost its quotes. If you try to stack deploy
the output then you get the error services.nginx.deploy.resources.limits.cpus must be a string
.
This is the output from 1.22 - which is correct and will deploy as a stack:
docker-compose config
services:
nginx:
deploy:
resources:
limits:
cpus: '0.75'
image: nginx
version: '3.7'
Docker Desktop Edge on Windows.
Also experiencing this issue, reverting to docker-compose 1.26 solves it.
Most helpful comment
Also experiencing this issue, reverting to docker-compose 1.26 solves it.