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

Set correct PATH for exec form #1342

Merged
merged 5 commits into from
Aug 13, 2020
Merged

Set correct PATH for exec form #1342

merged 5 commits into from
Aug 13, 2020

Conversation

aca
Copy link
Contributor

@aca aca commented Jul 3, 2020

Fixes #1304

Go exec.Command return error immediately if it fail to find executable in PATH.
https://github.com/golang/go/blob/dd150176c3cc49da68c8179f740eadc79404d351/src/os/exec/exec.go#L169-L182

In case of exec form in Dockerfile,

cmd := exec.Command(newCommand[0], newCommand[1:]...)

This commands would fail (in most cases) as we didn't set PATH environment for command yet.

Simplest Dockerfile to reproduce issue.

FROM golang:1.14.2-alpine
COPY . .
RUN ["go", "run", "main.go"]

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Release Notes

- Set correct PATH for exec form

@googlebot googlebot added the cla: yes CLA signed by all commit authors label Jul 3, 2020
@tejal29 tejal29 merged commit bfd92b5 into GoogleContainerTools:master Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate-release cla: yes CLA signed by all commit authors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker exec form just not working
3 participants