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

dockerfile: set correct default path and shell based on OS #1747

Merged
merged 3 commits into from
Oct 26, 2020

Conversation

tonistiigi
Copy link
Member

fixes #1560

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@@ -227,7 +227,7 @@ func (gwCtr *gatewayContainer) Start(ctx context.Context, req client.StartReques
if procInfo.Meta.Cwd == "" {
procInfo.Meta.Cwd = "/"
}
procInfo.Meta.Env = addDefaultEnvvar(procInfo.Meta.Env, "PATH", utilsystem.DefaultPathEnv)
procInfo.Meta.Env = addDefaultEnvvar(procInfo.Meta.Env, "PATH", utilsystem.DefaultPathEnvUnix) // support windows?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coryb Discovered that there is no way to check platform here. Do you think it may become a problem in the future and should we extend this somehow?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can plumb the platform information through NewContainer if we need to. It seems like something that would not be to hard to add on later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coryb I think we should do it. It can be optional so doesn't complicate the client side. Another case where it may come up is if in the future there is a fully distributed mode and BuildKit needs to chose the correct node for the container (eg. windows/linux or arch based). so basically should add both of these fields https://github.com/moby/buildkit/blob/master/solver/pb/ops.proto#L21-L22

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can file an issue and take that on after this PR gets merged. Sound good?

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@@ -153,7 +153,13 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
}
if c.Caps != nil {
if err := c.Caps.Supports(pb.CapExecMetaSetsDefaultPath); err != nil {
env = env.SetDefault("PATH", system.DefaultPathEnv)
os := "linux"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be runtime.GOOS?

Copy link
Member Author

@tonistiigi tonistiigi Oct 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is client side and does not represent the exec os. Usually this should be set and unix is better default than windows. Note also that this is only executed on missing cap that was added a long time ago so very theoretical to ever reach these lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image config uses linux shell/path when cross compiling for windows
3 participants