mirror of
https://github.com/containers/podman.git
synced 2025-10-19 12:12:36 +08:00
Fix network connect race with docker-compose
Network connect/disconnect has to call the cni plugins when the network namespace is already configured. This is the case for `ContainerStateRunning` and `ContainerStateCreated`. This is important otherwise the network is not attached to this network namespace and libpod will throw errors like `network inspection mismatch...` This problem happened when using `docker-compose up` in attached mode. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -1090,7 +1090,7 @@ func (c *Container) NetworkDisconnect(nameOrID, netName string, force bool) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.newNetworkEvent(events.NetworkDisconnect, netName)
|
c.newNetworkEvent(events.NetworkDisconnect, netName)
|
||||||
if c.state.State != define.ContainerStateRunning {
|
if !c.ensureState(define.ContainerStateRunning, define.ContainerStateCreated) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1145,7 +1145,7 @@ func (c *Container) NetworkConnect(nameOrID, netName string, aliases []string) e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.newNetworkEvent(events.NetworkConnect, netName)
|
c.newNetworkEvent(events.NetworkConnect, netName)
|
||||||
if c.state.State != define.ContainerStateRunning {
|
if !c.ensureState(define.ContainerStateRunning, define.ContainerStateCreated) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if c.state.NetNS == nil {
|
if c.state.NetNS == nil {
|
||||||
|
@ -183,6 +183,8 @@ function test_port() {
|
|||||||
fi
|
fi
|
||||||
echo "# cat $WORKDIR/server.log:"
|
echo "# cat $WORKDIR/server.log:"
|
||||||
cat $WORKDIR/server.log
|
cat $WORKDIR/server.log
|
||||||
|
echo "# cat $logfile:"
|
||||||
|
cat $logfile
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user