File tree 2 files changed +10
-13
lines changed
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) {
353
353
354
354
if process .Init {
355
355
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
- }
369
356
}
370
357
return nil
371
358
}
Original file line number Diff line number Diff line change 6
6
"os"
7
7
8
8
"github.com/opencontainers/runc/libcontainer"
9
+ "github.com/opencontainers/runc/libcontainer/configs"
9
10
"github.com/urfave/cli"
10
11
)
11
12
@@ -42,6 +43,15 @@ your host.`,
42
43
if notifySocket != nil {
43
44
return notifySocket .waitForContainer (container )
44
45
}
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
+ }
45
55
return nil
46
56
case libcontainer .Stopped :
47
57
return errors .New ("cannot start a container that has stopped" )
You can’t perform that action at this time.
0 commit comments