-
Notifications
You must be signed in to change notification settings - Fork 88
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
Unable to use the "--env" option on finch container run #827
Comments
Thanks for the issue. The command works properly when you use
The
|
In the following code: limaArgs = append(limaArgs, append([]string{nerdctlCmdName}, strings.Fields(cmdName)...)...)
var finalArgs []string
for key, val := range envVars {
finalArgs = append(finalArgs, "-e", fmt.Sprintf("%s=%s", key, val))
}
finalArgs = append(finalArgs, nerdctlArgs...)
// Add -E to sudo command in order to preserve existing environment variables, more info:
// https://stackoverflow.com/questions/8633461/how-to-keep-environment-variables-when-using-sudo/8633575#8633575
limaArgs = append(limaArgs, finalArgs...) The environment variables (such as |
Issue #, if available: #827 Description of changes: Addresses #827 by adding all environment variables at the location of first occurrence of the environment flag Testing done: Changes tested locally to ensure that the issue is fixed. $ ./_output/bin/finch container run --debug -it --rm --env="E=v" busybox env DEBU[0000] Creating limactl command: ARGUMENTS: [shell finch sudo -E nerdctl container run -e E=v -it --rm busybox env], LIMA_HOME: /Users/mharwani/work/runfinch/finch/_output/lima/data PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin E=v TERM=xterm HOME=/root *Testing done:* - [ ] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Shubharanshu Mahapatra <[email protected]>
Tested release 1.1.3 The original bug report is now fixed. However as explained in the PR the following does not work finch container run -it --rm -e "E=v" busybox echo -e "hello\tbye" |
Describe the bug
Cannot use
--env
optionSteps to reproduce
finch container run -it --rm --env="E=v" busybox env
Expected behavior
Screenshots or logs
Actual result
Additional context
Note: Updated to Finch 1.1.2 -- error still present
As a test I ran
nerdctl
(installed via Rancher Desktop) and it worked as expected$ nerdctl container run -it --rm --env="E=v" busybox env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin E=v TERM=xterm HOME=/root
To help debug the issue as quickly as possible, we recommend generating a support bundle with
finch support-bundle generate
and attaching it to this issue. This packages all Finch-related configs and logs into one file.finch-support-20240222101339.zip
The text was updated successfully, but these errors were encountered: