Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error "must be a boolean" with yes scalar in Docker Compose v2.17.0 #10465

Closed
advanceboy opened this issue Apr 12, 2023 · 3 comments · Fixed by #10470
Closed

[BUG] Error "must be a boolean" with yes scalar in Docker Compose v2.17.0 #10465

advanceboy opened this issue Apr 12, 2023 · 3 comments · Fixed by #10470
Labels

Comments

@advanceboy
Copy link

advanceboy commented Apr 12, 2023

Description

I encountered an error with Docker Compose v2.17.0 when trying to load the following compose file:

version: '3'
services:
  ttt-test-pg:
    image: postgres
    environment:
      POSTGRES_PASSWORD: mysecretpassword 
    volumes:
      - type: bind
        source: ./data
        target: /var/lib/postgresql/data
        read_only: yes

The error message is below:

services.ttt-test-pg.volumes.0.read_only must be a boolean

This issue did not occur in v2.16.

Steps To Reproduce

  1. Windows 10
  2. Docker compose v2.17.0
  3. Copy the above compose.yml
  4. Then docker compose build
  5. You will see the error

Compose Version

Docker: Docker version 20.10.24, build 297e128
Compose: Docker Compose version v2.17.2 @ Windows 10

Docker Environment

No response

Anything else?

Like #10411, it seems that the update to go-yaml/v3 is the root cause of this issue. While there was a breaking change from YAML 1.1 to 1.2 where yes/no and on/off are no longer considered booleans, go-yaml/v3 does support decoding to typed bool.

For compatibility reasons, it would be desirable for Docker Compose to accept yes/no and on/off as booleans when a boolean scalar is expected.

@ndeloof
Copy link
Contributor

ndeloof commented Apr 13, 2023

see compose-spec/compose-go#382

yes as a boolean value is indeed a legacy yaml syntax which has been removed from the YAML spec with 1.2 release in 2009 (before docker compose existed), that's just sad compose was built with a 1.0/1.1 yaml parser and did not adopted this earlier

@advanceboy advanceboy changed the title [BUG] Error with 'read_only: yes' in Docker Compose v2.17.0 [BUG] Error "must be a boolean" with yes scalar in Docker Compose v2.17.0 Apr 13, 2023
@advanceboy
Copy link
Author

compose-spec/compose-go#382 has been updated from the original pull request to stop support for the legacy boolean.

So, I've post a separate pull request, compose-spec/compose-go#390, solely to add support for the legacy boolean.

@ndeloof
Copy link
Contributor

ndeloof commented Apr 15, 2023

@advanceboy no need to start a PR competition :)
we can just debate here. I agree with you having backward compatible support with warning, at least for a transition period, would be a nicer approach. I'll discuss this with the team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants