Compose: `config` output strips quote marks and loses version number

Created on 17 Sep 2020  路  1Comment  路  Source: docker/compose

Description of the issue

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.

Context information (for bug reports)

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

Steps to reproduce the issue

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.

Expected result

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'

Additional information

Docker Desktop Edge on Windows.

kinbug

Most helpful comment

Also experiencing this issue, reverting to docker-compose 1.26 solves it.

>All comments

Also experiencing this issue, reverting to docker-compose 1.26 solves it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saulshanabrook picture saulshanabrook  路  3Comments

dimsav picture dimsav  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments

guycalledseven picture guycalledseven  路  3Comments

Hendrik-H picture Hendrik-H  路  3Comments