-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
docker run
throws error if an env var contains whitespace
#5057
Comments
This looks similar to / related to #4665 (comment) The format used for files specified by |
It appears compose uses I'm a new contributor, but if you want I can push a pr for a test case of using a bad header with a space such as |
Signed-off-by: MicahKimel <micah.kimel@my.wheaton.edu>
Signed-off-by: MicahKimel <micah.kimel@my.wheaton.edu>
Signed-off-by: MicahKimel <micah.kimel@my.wheaton.edu>
Description
Encountered an inconsistency in one of my projects. Perhaps it could be user error or a misunderstanding but it is related to how
docker run
behaves compared todocker compose run
.Left a minimal example below but happy to provide more info if it is not clear enough.
Please let me know if this is the appropriate tracker to file this under.
Reproduce
test.env
using a multiline variable like so:docker run
:docker run --rm --env-file test.env alpine:latest sh -c 'echo "$SECRET_SETTING"'
However, the following works as expected using the same
test.env
from above.docker-compose.yaml
file like so:docker compose run
:Expected behavior
Expected
docker run
anddocker compose run
to behave similarly in these cases.docker version
Client: Docker Engine - Community Version: 24.0.6 API version: 1.43 Go version: go1.20.7 Git commit: ed223bc Built: Mon Sep 4 12:31:44 2023 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 24.0.6 API version: 1.43 (minimum version 1.12) Go version: go1.20.7 Git commit: 1a79695 Built: Mon Sep 4 12:31:44 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.24 GitCommit: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 runc: Version: 1.1.9 GitCommit: v1.1.9-0-gccaecfc docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
This is a simplified example of a larger use case where I am setting some sensitive settings in GitHub Secrets and was trying to avoid an extra step of base64 encoding since it makes it less readable. A space is required in the spec for the setting.
Normally, I'd proceed with
docker compose run
version, however, I am not calling it directly. VSCode+DevContainer is callingdocker run
during the creation of the environment.Alternative suggestions welcome.
Related to docker/compose#6951 though using
docker compose
worked fine for me.The text was updated successfully, but these errors were encountered: