-
Notifications
You must be signed in to change notification settings - Fork 317
Setup environment for processes with os.Environ() #418
Conversation
currently genericError constructors require not-nil error to be able to read its Error() message Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
if the error is nil, we do not populate generic error's message, but the constructor will still return a valid error Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
@dqminh Some error on jenkins. Looks like easy to fix. |
@dqminh Btw very good catch about |
instead of taking the raw config.Env, we use `os.Environ()` which works correctly because the environment has been setup properly with `newContainerInit` Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
instead of taking the raw config.Env, we use `os.Environ()` which works correctly because the environment has been setup properly with `newContainerInit` Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
ping @jfrazelle |
I rebuilt ;) |
@jfrazelle Thank you very much! |
LGTM |
1 similar comment
LGTM |
@dqminh Can you squash some of the commits? |
@rjnagal which commits do you want me to squash. The two commits that set os.Environ() for both setns and init process ? |
yes, the last two. |
Why do we need to do this? why is config.Env not enough? |
@crosbymichael There is no |
why is there no PATH and home? docker prepopulates both of these either in the image or there is a hard coded default for PATH |
I don't know actually :/ |
@crosbymichael @LK4D4 i think the reason there's no PATH or HOME is because we set HOME / PATH with Setenv, but exec the process with |
I really don't think we should do this because it will cause env vars to leak into the container. The config.Env should have everything that the container's process needs, if it does not, I think it's a bug. I'm just scared by doing this we will get a custom PATH that the user specified overwritten. |
I'm not sure about PATH, but "HOME" we set indeed before |
I agree with @crosbymichael . We should be able to modify config.Env ourselves. @LK4D4 I think that should work. |
At least we need fix for |
agreed. I will remove the |
Replacement of docker-archive#418 Signed-off-by: Alexander Morozov <lk4d4@docker.com>
genericError
constructor should not panic when we pass innil
error, but we should not pass nil error actually. This fixes it.os.Environ()
when execve which works correctly because the environment has been setup properly withnewContainerInit