Skip to content

Execute Docker credential programm through shell on Windows #4763

Merged
rnorth merged 1 commit intotestcontainers:masterfrom
mruemeli:process_builder_path_problem
Dec 3, 2021
Merged

Execute Docker credential programm through shell on Windows #4763
rnorth merged 1 commit intotestcontainers:masterfrom
mruemeli:process_builder_path_problem

Conversation

@mruemeli
Copy link
Contributor

@mruemeli mruemeli commented Dec 2, 2021

We are trying to run testcontainers on Windows with an internal repository hosted by Google. This requires to run the"docker-credential-gcloud" (from Google Cloud SDK) to obtain credentials by using zt-exec. Eventhough the bin folder of the SDK is listed in the Path environment variables the ProcessExecutor is not able to run it and fails with the error message "Cannot run program "docker-credential-gcloud": CreateProcess error=2, Das System kann die angegebene Datei nicht finden"
(meaning "The system could not find the specified file.").

The reason is that the PATH envionment variable is not honored when starting a process on Windows. See zt-exec bug report zeroturnaround/zt-exec#98 (comment)

The following patch forces the command to be executed on cmd shell on Windows to ensure PATH is used.

@kiview
Copy link
Member

kiview commented Dec 2, 2021

Thanks a lot for raising this PR @mruemeli, the explanation makes a lot of sense.

LGTM.

Can you have another look @rnorth?

@rnorth
Copy link
Member

rnorth commented Dec 3, 2021

This looks sensible to me too - thanks @mruemeli!

@rnorth rnorth merged commit 4aef1dc into testcontainers:master Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants