diff --git a/plugins/network/triggers.go b/plugins/network/triggers.go index 184b1a02a..8fa11724a 100644 --- a/plugins/network/triggers.go +++ b/plugins/network/triggers.go @@ -174,6 +174,15 @@ func TriggerPostContainerCreate(containerType string, containerID string, appNam return } + exists, err := networkExists(networkName) + if err != nil { + common.LogFail(err.Error()) + } + + if !exists { + common.LogFail(fmt.Sprintf("Network %v does not exist", networkName)) + } + attachAppToNetwork(containerID, networkName, appName, phase, processType) } @@ -208,6 +217,15 @@ func TriggerCorePostDeploy(appName string) { common.LogFail(err.Error()) } + exists, err := networkExists(networkName) + if err != nil { + common.LogFail(err.Error()) + } + + if !exists { + common.LogFail(fmt.Sprintf("Network %v does not exist", networkName)) + } + for _, containerID := range containerIDs { processType, err := common.DockerInspect(containerID, "{{ index .Config.Labels \"com.dokku.process-type\"}}") if err != nil {