Parcourir la source

fix container name matching?

reid il y a 2 ans
Parent
commit
80a8506b0f
2 fichiers modifiés avec 5 ajouts et 2 suppressions
  1. 2 1
      docker/docker.go
  2. 3 1
      structs/structs.go

+ 2 - 1
docker/docker.go

@@ -131,7 +131,7 @@ func StartContainer(containerName string, containerType string) (structs.Contain
 	var existingContainer *types.Container = nil
 	for _, container := range containers {
 		for _, name := range container.Names {
-			if name == "/"+containerName {
+			if name == containerName {
 				existingContainer = &container
 				break
 			}
@@ -333,6 +333,7 @@ func DockerPoller() {
 		select {
 		case <-ticker.C:
 			logger.Info("polling docker")
+			// todo (maybe not necessary?)
 			// fetch the status of all containers and compare with app's state
 			// if there's a change, send an event to the EventBus
 			return

+ 3 - 1
structs/structs.go

@@ -18,7 +18,9 @@ type ContainerState struct {
 	Name          string
 	Type          string
 	Image         string
-	ActualStatus  string
+	ActualStatus  string // on/off
 	DesiredStatus string
+	ActualNetwork string // bridge/wireguard
+	DesiredNetwork string
 	CreatedAt     string
 }