Skip to content

Commit

Permalink
Merge pull request #10654 from Luap99/net-connect
Browse files Browse the repository at this point in the history
Fix network connect race with docker-compose
  • Loading branch information
openshift-merge-robot authored Jun 12, 2021
2 parents 45dc3d6 + 44d9c45 commit d1cb5d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libpod/networking_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ func (c *Container) NetworkDisconnect(nameOrID, netName string, force bool) erro
}

c.newNetworkEvent(events.NetworkDisconnect, netName)
if c.state.State != define.ContainerStateRunning {
if !c.ensureState(define.ContainerStateRunning, define.ContainerStateCreated) {
return nil
}

Expand Down Expand Up @@ -1145,7 +1145,7 @@ func (c *Container) NetworkConnect(nameOrID, netName string, aliases []string) e
return err
}
c.newNetworkEvent(events.NetworkConnect, netName)
if c.state.State != define.ContainerStateRunning {
if !c.ensureState(define.ContainerStateRunning, define.ContainerStateCreated) {
return nil
}
if c.state.NetNS == nil {
Expand Down
2 changes: 2 additions & 0 deletions test/compose/test-compose
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ function test_port() {
fi
echo "# cat $WORKDIR/server.log:"
cat $WORKDIR/server.log
echo "# cat $logfile:"
cat $logfile
return
fi

Expand Down

0 comments on commit d1cb5d1

Please sign in to comment.