Don't spam warnings when stopped container discovered (#530)

This commit is contained in:
Geoff Bourne
2026-02-27 07:08:39 -06:00
committed by GitHub
parent 2023e73892
commit 6d82553a65
2 changed files with 54 additions and 17 deletions
+37
View File
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
// Use bookworm due to
// (!) The 'moby' option is not supported on Debian 'trixie' because 'moby-cli' and related system packages have been removed from that distribution.
// (!) To continue, either set the feature option '"moby": false' or use a different base image (for example: 'debian:bookworm' or 'ubuntu-24.04').
"image": "golang:1.25-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// For in-docker discovery testing
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
25565
],
containerEnv: {
"GOROOT": "/usr/local/go"
},
// Configure tool-specific properties.
"customizations": {
"jetbrains": {
"backend": "IntelliJ",
"plugins": [
"org.jetbrains.plugins.go"
]
},
"vscode": {
"extensions": [
"golang.go"
]
}
}
}
+17 -17
View File
@@ -19,13 +19,13 @@ type IDockerWatcher interface {
}
const (
DockerRouterLabelHost = "mc-router.host"
DockerRouterLabelPort = "mc-router.port"
DockerRouterLabelDefault = "mc-router.default"
DockerRouterLabelNetwork = "mc-router.network"
DockerRouterLabelAutoScaleUp = "mc-router.auto-scale-up"
DockerRouterLabelAutoScaleDown = "mc-router.auto-scale-down"
DockerRouterLabelAutoScaleAsleepMOTD = "mc-router.auto-scale-asleep-motd"
DockerRouterLabelHost = "mc-router.host"
DockerRouterLabelPort = "mc-router.port"
DockerRouterLabelDefault = "mc-router.default"
DockerRouterLabelNetwork = "mc-router.network"
DockerRouterLabelAutoScaleUp = "mc-router.auto-scale-up"
DockerRouterLabelAutoScaleDown = "mc-router.auto-scale-down"
DockerRouterLabelAutoScaleAsleepMOTD = "mc-router.auto-scale-asleep-motd"
DockerRouterLabelAutoScaleLoadingMOTD = "mc-router.auto-scale-loading-motd"
)
@@ -342,16 +342,16 @@ func (w *dockerWatcherImpl) listContainers(ctx context.Context) ([]*routableCont
}
type parsedDockerContainerData struct {
hosts []string
port uint64
def *bool
network *string
ip string
autoScaleDown bool
autoScaleUp bool
autoScaleAsleepMOTD string
hosts []string
port uint64
def *bool
network *string
ip string
autoScaleDown bool
autoScaleUp bool
autoScaleAsleepMOTD string
autoScaleLoadingMOTD string
notRunning bool
notRunning bool
}
func (w *dockerWatcherImpl) parseContainerData(container *container.InspectResponse) (data parsedDockerContainerData, ok bool) {
@@ -494,7 +494,7 @@ func (w *dockerWatcherImpl) parseContainerData(container *container.InspectRespo
if container.State != nil && !container.State.Running {
if !w.config.autoScaleUp {
logrus.WithFields(logrus.Fields{"containerId": container.ID, "containerNames": container.Name}).
Warnf("ignoring container, not running and auto scale up is disabled")
Debugf("ignoring container, not running and auto scale up is disabled")
return
}
data.notRunning = true