-
Notifications
You must be signed in to change notification settings - Fork 765
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
Feature request - ${VAR_NAME:?} dockerfile syntax to error on unset variables #4284
Feature request - ${VAR_NAME:?} dockerfile syntax to error on unset variables #4284
Comments
Hi @jwhitaker-swiftnav , Thanks for creating the issue. I was unable to find any formal documentation on docker side for this, but I think we can implement this at imagebuilder. @nalind Any thoughts ? Since this is not a documented behavior on docker. |
A friendly reminder that this issue had no activity for 30 days. |
If this is a legitimate Dockerfile then we should support it. Whether it is documented or not. (Well maybe not if it is considered experimental) @edsantiago Is this a special Bashism? |
It's a common bashism; I have no knowledge of docker's level of support for it.
|
Seams reasonable. |
@rhatdan @edsantiago Importantly, this is not a Bashism, but standard/POSIX/SUS. It also works in practice in other shells, e.g., Ash. |
@flouthoc any time to work on it? |
A friendly reminder that this issue had no activity for 30 days. |
@flouthoc any time to work on it? |
I'll check this thanks. |
A friendly reminder that this issue had no activity for 30 days. |
Docker supports ${SOME_VAR:?} syntax, which will give an error at build if SOME_VAR is unset. ```dockerfile FROM alpine ARG USERID USER ${USERID:?} ``` ```console Failed to process `${USERID:?}`: USERID is not allowed to be unset ``` Closes: containers/buildah#4284 Ref: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 Signed-off-by: Aditya R <arajan@redhat.com>
@jwhitaker-swiftnav Thanks PR openshift/imagebuilder#243 should close this. |
Docker supports ${SOME_VAR:?} syntax, which will give an error at build if SOME_VAR is unset. ```dockerfile FROM alpine ARG USERID USER ${USERID:?} ``` ```console Failed to process `${USERID:?}`: USERID is not allowed to be unset ``` Closes: containers/buildah#4284 Ref: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 Signed-off-by: Aditya R <arajan@redhat.com>
Description
Docker supports ${SOME_VAR:?} syntax, which will give an error at build if SOME_VAR is unset. I believe this is directly in the Dockerfile syntax, not via a shell. Buildah doesn't support this, so this feature request is to request support for this syntax.
Example:
Docker
docker build .
Buildah/Podman
Buildah/Podman don't support this syntax:
podman build .
This is a genuinely useful feature, so my request goes beyond just for the sake of compatibility.
Extra Info
Output of
podman version
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes/No
Latest version in the kubic repo, haven't tried building from master.
Additional environment details (AWS, VirtualBox, physical, etc.):
Docker version for comparison:
The text was updated successfully, but these errors were encountered: