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

Building docker-compose files may choke on env_files with spaces #903

Closed
jcfj opened this issue Jan 5, 2022 · 3 comments · Fixed by #905
Closed

Building docker-compose files may choke on env_files with spaces #903

jcfj opened this issue Jan 5, 2022 · 3 comments · Fixed by #905

Comments

@jcfj
Copy link

jcfj commented Jan 5, 2022

Quick problem reproducer:

echo '{"services":{"scratch":{"build":".","env_file":["env"]}},"version":"3"}' >docker-compose.yaml
echo FROM alpine >Dockerfile
echo asdf=bsdf -csdf >env
docker buildx bake

Fails with

[+] Building 0.0s (0/0)                                                                                                                                                      
error: unexpected character "-" in variable name near "-csdf\n"

but builds and runs fine with docker-compose build.
The problem is likely that the env parser treats the env file as space separated, where it is actually line separated (and anyway bake shouldn't have to care, since the env file is only used during execution).

@jcfj jcfj changed the title Building docker-compose files may choke on env_files with Building docker-compose files may choke on env_files with spaces Jan 5, 2022
@tonistiigi
Copy link
Member

@crazy-max Is it just compose behavior because I don't think we do any env parsing?

@jcfj
Copy link
Author

jcfj commented Jan 6, 2022

You do do env parsing:

Reading the source, I should probably re-report this bug against compose-go?

@tonistiigi
Copy link
Member

Reading the source, I should probably re-report this bug against compose-go?

If you can reproduce with compose-go as well then yes. Seems to me as well that the relevant code is in there.

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

Successfully merging a pull request may close this issue.

3 participants