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] using an empty compose file causes project name to be unset #11450

Closed
designermonkey opened this issue Feb 2, 2024 · 3 comments · Fixed by compose-spec/compose-go#578
Closed
Assignees
Labels

Comments

@designermonkey
Copy link

designermonkey commented Feb 2, 2024

Description

I have a command which concatenates multiple docker-compose yaml files, like so:

docker compose -f ./docker-compose.yml -f ./docker-compose.dev.yml -f ./docker-compose.uat.yml build

Because of the way our local build system works, the last file is empty until we define specifics for our UAT process. We have defined the name top-level element in the initial docker-compose.yml file.

Using this empty placeholder file at the end of the list seems to unset content from the other files resulting in the following:

project name can't be empty. Use `--project-name` to set a valid name

I can't check whether it is unsetting other content as well

Steps To Reproduce

Use multiple compose files with content, except the last file which is empty:

docker compose -f ./docker-compose.yml -f ./docker-compose.dev.yml -f ./docker-compose.uat.yml build

Compose Version

v2.24.3-desktop.1

Docker Environment

Docker desktop: 4.27.1 (136059) on Mac OS 14.2.1 (23C71)

Anything else?

I accidentally pressed enter while filling out the form, if anything is missing, please let me know.

@designermonkey
Copy link
Author

If I add --- to the top of the empty file, I get Top-level object must be a mapping instead.

Shouldn't an empty yaml file still be considered valid yaml content? (I don't actually know).

@milas
Copy link
Contributor

milas commented Mar 6, 2024

This fix has been included in Compose 2.24.7+. If you continue to have problems after upgrading, comment here and we can re-open the issue or create a new one as appropriate. Thanks for the report!

@digglife
Copy link

digglife commented Oct 4, 2024

Thanks. Can't update for some reason so I added name: foo to the empty yaml.

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.

4 participants