mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Merge pull request #4629 from mheon/fix_indirect_netnsctr_lookup
Allow chained network namespace containers
This commit is contained in:
@ -1146,7 +1146,7 @@ func (c *Container) NetworkDisabled() (bool, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
return networkDisabled(container)
|
return container.NetworkDisabled()
|
||||||
}
|
}
|
||||||
return networkDisabled(c)
|
return networkDisabled(c)
|
||||||
|
|
||||||
|
@ -1016,9 +1016,24 @@ func (c *Container) makeBindMounts() error {
|
|||||||
// We want /etc/resolv.conf and /etc/hosts from the
|
// We want /etc/resolv.conf and /etc/hosts from the
|
||||||
// other container. Unless we're not creating both of
|
// other container. Unless we're not creating both of
|
||||||
// them.
|
// them.
|
||||||
depCtr, err := c.runtime.state.Container(c.config.NetNsCtr)
|
var (
|
||||||
if err != nil {
|
depCtr *Container
|
||||||
return errors.Wrapf(err, "error fetching dependency %s of container %s", c.config.NetNsCtr, c.ID())
|
nextCtr string
|
||||||
|
)
|
||||||
|
|
||||||
|
// I don't like infinite loops, but I don't think there's
|
||||||
|
// a serious risk of looping dependencies - too many
|
||||||
|
// protections against that elsewhere.
|
||||||
|
nextCtr = c.config.NetNsCtr
|
||||||
|
for {
|
||||||
|
depCtr, err = c.runtime.state.Container(nextCtr)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrapf(err, "error fetching dependency %s of container %s", c.config.NetNsCtr, c.ID())
|
||||||
|
}
|
||||||
|
nextCtr = depCtr.config.NetNsCtr
|
||||||
|
if nextCtr == "" {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need that container's bind mounts
|
// We need that container's bind mounts
|
||||||
|
Reference in New Issue
Block a user