Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

compose config removes needed quotes, resulting in ".UnicodeDecodeError 'utf8-8' codec can't decode #2036

@rfay

Description

@rfay

Description

docker-compose config removes required yaml quoting

For example, a value - 'X=somevalue will be transformed by docker-compose config to - X=somevalue, with no quotes.

This is not a problem with simple values, but becomes a problem with utf-8 values, like 'André Kraus' or 'Mück' and you end up with invalid yaml.

This problem exists in both docker-compose v1 and docker-compose v2, all versions AFAICT

Steps to reproduce the issue:

Use this docker-compose.yaml:

services:
  web:
    image: busybox
    environment:
      - 'SOMEENV=André Kraus'

docker-compose config (either v1 or v2) will transform it to

services:
  web:
    environment:
      SOMEENV: André Kraus
    image: busybox
    networks:
      default: null
networks:
  default:
    name: ddev_default

which for some values of SOMEENV will result in invalid yaml and ".UnicodeDecodeError 'utf8-8' codec can't decode"

Describe the results you received:

Invalid yaml due to removal of quotes

Describe the results you expected:

Why not keep the quotes on there?

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker-compose --version:

All versions, 1 and 2

I have tested this on Windows to get failure with this setup.

  • docker-compose v2.0.0-rc.1 gets "yaml: invalid trailing UTF-8 octet" when you try to use docker-compose -f dc.yaml up with a file created by docker-compose conf > dc.yaml
  • docker-compose 1.29.2 with docker-compose config >dc.yaml and docker-compose -f dc.yaml up gets ".UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 56: invalid continuation byte"

On macOS I get other problems, but not a complete failure like this.

Anyway, leave the quotes on!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions