Merge pull request #21522 from Luap99/restart-userns

fix userns + restart policy with slirp4netns
This commit is contained in:
openshift-merge-bot[bot]
2024-02-08 10:41:54 +00:00
committed by GitHub
2 changed files with 26 additions and 11 deletions

View File

@ -306,9 +306,13 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err
return false, err
}
// set up slirp4netns again because slirp4netns will die when conmon exits
if err := c.setupRootlessNetwork(); err != nil {
return false, err
// only do this if the container is not in a userns, if we are the cleanupNetwork()
// was called above and a proper network setup is needed which is part of the init() below.
if !c.config.PostConfigureNetNS {
// set up slirp4netns again because slirp4netns will die when conmon exits
if err := c.setupRootlessNetwork(); err != nil {
return false, err
}
}
if c.state.State == define.ContainerStateStopped {