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: Cannot recognise bash-style arguments in Dockerfile #336

Closed
ShauryaAg opened this issue Dec 22, 2022 · 1 comment · Fixed by #337
Closed

bug: Cannot recognise bash-style arguments in Dockerfile #336

ShauryaAg opened this issue Dec 22, 2022 · 1 comment · Fixed by #337
Assignees
Labels
bug Something isn't working

Comments

@ShauryaAg
Copy link
Contributor

ShauryaAg commented Dec 22, 2022

devcontainer cli is unable to parse bash-style arguments, that is, arguments of type ${arg1:+"something"}

For example:
When using the below Dockerfile

ARG cloud
FROM ${cloud:+"my.ecr.repo/"}myimage:tag

The output after parsing should be, if the value cloud ARG is set:

FROM my.exr.repo/myimage:tag

and otherwise should be:

FROM myimage:tag

However,
devcontainer cli throws an error that it cannot parse the above mentioned Dockerfile

[11 ms] @devcontainers/cli 0.25.2. Node.js v16.14.2. darwin 21.2.0 arm64.
[469 ms] Parsed version '+' for input 'docker.io/library/1:+' failed validation.
Error: Command failed: docker inspect --type image 1:+
    at Aoe (/Users/shaurya/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:70182:9)
    at uT (/Users/shaurya/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:70175:11)
    at async Poe (/Users/shaurya/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:70543:34)
    at async Zf (/Users/shaurya/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:70597:9)
    at async aue (/Users/shaurya/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:72760:13)
    at async oue (/Users/shaurya/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:72747:9)
{"outcome":"error","message":"Command failed: docker inspect --type image 1:+","description":"An error occurred setting up the container."}

In the above run, the value of cloud argument was set to 1, hence it outputted 1:+, which is not the expected result.

devcontainer cli version: 0.25.2

Reference:

@ShauryaAg ShauryaAg changed the title bug: Cannot recognise boolean arguments in Dockerfile bug: Cannot recognise bash-style arguments in Dockerfile Dec 22, 2022
@ShauryaAg
Copy link
Contributor Author

Hey, @joshspicer I have submitted a PR for the reported issue, could you please review it?

@chrmarti chrmarti self-assigned this Dec 30, 2022
@chrmarti chrmarti added the bug Something isn't working label Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants