File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -353,19 +353,6 @@ func (c *Container) start(process *Process) (retErr error) {
353353
354354 if process .Init {
355355 c .fifo .Close ()
356- if c .config .Hooks != nil {
357- s , err := c .currentOCIState ()
358- if err != nil {
359- return err
360- }
361-
362- if err := c .config .Hooks .Run (configs .Poststart , s ); err != nil {
363- if err := ignoreTerminateErrors (parent .terminate ()); err != nil {
364- logrus .Warn (fmt .Errorf ("error running poststart hook: %w" , err ))
365- }
366- return err
367- }
368- }
369356 }
370357 return nil
371358}
Original file line number Diff line number Diff line change 66 "os"
77
88 "github.com/opencontainers/runc/libcontainer"
9+ "github.com/opencontainers/runc/libcontainer/configs"
910 "github.com/urfave/cli"
1011)
1112
@@ -42,6 +43,15 @@ your host.`,
4243 if notifySocket != nil {
4344 return notifySocket .waitForContainer (container )
4445 }
46+ s , err := container .OCIState ()
47+ if err != nil {
48+ return err
49+ }
50+ if container .Config ().Hooks != nil {
51+ if err := container .Config ().Hooks [configs .Poststart ].RunHooks (s ); err != nil {
52+ return fmt .Errorf ("run poststart hook %w" , err )
53+ }
54+ }
4555 return nil
4656 case libcontainer .Stopped :
4757 return errors .New ("cannot start a container that has stopped" )
You can’t perform that action at this time.
0 commit comments