Do not attempt releasing network when not attached to any network
| ... | ... |
@@ -903,6 +903,12 @@ func (container *Container) ReleaseNetwork() {
|
| 903 | 903 |
return |
| 904 | 904 |
} |
| 905 | 905 |
|
| 906 |
+ // If the container is not attached to any network do not try |
|
| 907 |
+ // to release network and generate spurious error messages. |
|
| 908 |
+ if container.NetworkSettings.NetworkID == "" {
|
|
| 909 |
+ return |
|
| 910 |
+ } |
|
| 911 |
+ |
|
| 906 | 912 |
n, err := container.daemon.netController.NetworkByID(container.NetworkSettings.NetworkID) |
| 907 | 913 |
if err != nil {
|
| 908 | 914 |
logrus.Errorf("error locating network id %s: %v", container.NetworkSettings.NetworkID, err)
|