-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add prestart/poststop hooks to runc #160
Conversation
@LK4D4 @crosbymichael ping |
@mrunalp Not sure if this is a related question, but can I get the pid of the container when I'm running a pre-start hook? Also, can I be running in the host's namespace? |
@ashahab-altiscale Yes for both I think. Cause it's like whole idea :D |
@LK4D4 @mrunalp sorry for the ignorance, but isn't this the same as doing I know that if it's included in runc it will be agnostic to the platform and becomes part of the spec but what are the advantages/use cases of doing it natively rather than from the OS? OT: Is there a place where runc features / roadmap is available to the community?. I'd be great of some users can actually take a look into it and maybe leave some comments which will make the product better. Thanks!. |
BTW: This doesn't have any tests? |
@marcosnils Actually, there is a difference and a reason why we introduce the prestart hook :) |
@mrunalp got it. My impression was correct, I though that the hooks were executed inside the container namespace. I still have to look into runc code a bit more to understand it's components. Thanks!. |
Rebased. |
// Call the poststop hooks | ||
statePath := p.container.stateFilePath() | ||
for _, poststopcmd := range p.poststop { | ||
// TODO: Log the errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
f32e01e
to
e3553a5
Compare
Added test. |
@crosbymichael @LK4D4 PTAL |
LGTM |
+1 Would love to see this get in soon so we can continue re-instatement of user namespace support merging into Docker. |
Rebased. |
+1 Lets get this merged! On Tue, Aug 18, 2015 at 3:01 PM, Mrunal Patel [email protected]
|
Still LGTM ping @LK4D4 @crosbymichael |
@@ -271,6 +294,27 @@ func (p *initProcess) createNetworkInterfaces() error { | |||
return nil | |||
} | |||
|
|||
func runCmd(command configs.Command, statePath string) error { | |||
cmd := exec.Command(command.Path, command.Args[:]...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exec.Command
doesn't let you set argv[0]
independently of command.Path
, which seemed like something desired by the spec (but the spec isn't clear on how it should be handled).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrunalp is there a reason to use exec.Command
instead of populating exec.Cmd
directly with the args ?
As @wking indicated exec.Command
forces the argv[0] to be the path : https://golang.org/src/os/exec/exec.go?s=3999:4044#L112 , and hence command.Args
can only occupy argv[1]...
IMO, the following is better
- cmd := exec.Command(command.Path, command.Args[:]...)
+ cmd := exec.Cmd{
+ Path: command.Path,
+ Args: command.Args[:],
+ }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
On Mon, Aug 03, 2015 at 11:02:57AM -0700, Mrunal Patel wrote:
If so, I think it's probably worth clarifing that in the spec. It For example, the host-environment semantics would let you manipulate I'm not even sure how in-container hooks would work, since the hook's |
@LK4D4 @crosbymichael ping |
@mrunalp do we want to wait on the state PR in specs so that we have something to provide the hook? |
@crosbymichael works for me. (We do pass state in this PR but it isn't standardized). |
Now that the state PR is completed, do you have time to update this @mrunalp? |
On Mon, Sep 07, 2015 at 02:26:36PM -0700, Phil Estes wrote:
Things that still have to happen: a. rebase this to pull in the state.json specified by (b) is external to this PR, so I don't see any need to rush forward |
On Thu, Aug 20, 2015 at 10:40:11AM -0700, W. Trevor King wrote:
I still haven't looked over the backing code here, but while testing |
#242 is in. Let's get this merged. 👍 |
4f7ff04
to
f29794b
Compare
Updated the PR to integrate with the libcontainer support. |
@LK4D4 @crosbymichael @dqminh PTAL. |
LGTM
Also +1 :-) |
f29794b
to
f7750e5
Compare
Updated to use State from the spec. @crosbymichael @LK4D4 @dqminh PTAL. |
can libcontainer continue to be specs free? even if go get'ing it still requires to pull specs for runc itself I like the configs layer in between and libcontainer users may benefit from having something before specs gets updated, no big deal tho |
Why not keep it json compatible then we don't have to mix the two? |
IMO |
Signed-off-by: Mrunal Patel <[email protected]>
Signed-off-by: Mrunal Patel <[email protected]>
f7750e5
to
dcafe48
Compare
@crosbymichael Updated. |
LGTM |
1 similar comment
LGTM |
Add prestart/poststop hooks to runc
Modify the capabilities constants to match header files like other constants
The spec.go commit will be taken out once merged upstream.
Signed-off-by: Mrunal Patel [email protected]