When using , containers that exit with code 0 (such
as init or oneshot containers) were incorrectly treated as failures,
causing the command to return exit code 1.
Introduce a typed containerExitError in isServiceHealthy and handle
exit code 0 in the RunningOrHealthy wait path. Services with restart
policies that restart on clean exit (always, unless-stopped) are
excluded via restartsOnExit0 to avoid false positives.
Fixes#10596
Signed-off-by: Guillaume Lours <[email protected]>
The moby/moby client (v0.2.2) validates that ConsoleSize is zero when
TTY is disabled, returning "console size is only supported when TTY is
enabled" otherwise. Previously, ConsoleSize was populated unconditionally
from GetTtySize(), which returns real terminal dimensions when Compose is
run interactively — causing post_start hooks to fail for services without
`tty: true`.
Fix by only reading and passing the console size when service.Tty is true.
Signed-off-by: Michael Irwin <[email protected]>
Resolves#13615
RunOneOffContainer was not executing post_start lifecycle hooks after
starting a container. This adds hook execution by listening for the
container's start event via the Docker Events API and running hooks
once the container is running, matching the behavior already present
in startService (used by docker compose up) and restart.
Signed-off-by: Varun Chawla <[email protected]>
Results of running the modernize command, with some minor changes
afterwards (removing the `contains` and `hasStatus` helper functions);
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
modernize -fix ./...
Signed-off-by: Sebastiaan van Stijn <[email protected]>
These consts were added in b760afaf9f,
but are only user internal in the package. Given that the list of
consts may change over time, it's probably best to keep them internal
and not part of the module's API.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use an intermediate serviceNetworks slice so that we don't have
to call service.NetworksByPriority multiple times.
- shift the primary network from the slice (if any), so that
we can drop some checks for "additional networks"
- group code related to setting up the primary network as first
step, then append remaining networks.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Format layer progress details with minimal efforts as new UI does
not render individual layers.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Format layer progress details with minimal efforts as new UI
does not render individual layers
Signed-off-by: Nicolas De Loof <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Also update TestDefaultNetworkSettings:
Test that the network with the highest priority is returned as
"primary" network, and other networks as extra networks.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
The driver.Auth interface was describing the configfile.GetAuthConfig
implementation; define a local interface instead of using buildx's
definition as an intermediate.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Until now, mustRecreate logic only checked for divergence in TypeVolume
mounts but ignored TypeImage mounts. This inconsistency caused containers
to erroneously retain stale images even after the source image was rebuilt.
This commit updates ensureImagesExists to resolve image volume sources to
their digests using the official reference package. This enables ServiceHash
(config hash) to naturally detect underlying image digest changes,
triggering recreation via the standard convergence logic.
An E2E test case is added to verify this behavior.
Fixes#13547
Signed-off-by: ibrahim yapar <[email protected]>
The condition for checking container restart state had incorrect operator
precedence. The expression:
inspect.State != nil && inspect.State.Restarting || inspect.State.Running
is evaluated as:
(inspect.State != nil && inspect.State.Restarting) || inspect.State.Running
This means if inspect.State is nil and inspect.State.Restarting is false
(which would trigger a panic), the code would attempt to access
inspect.State.Running, causing a nil pointer dereference.
This fix adds parentheses to ensure the nil check applies to both
state checks:
inspect.State != nil && (inspect.State.Restarting || inspect.State.Running)
Signed-off-by: Nepomuk Crhonek <[email protected]>
Add linter rules to prevent usage of context.Background() and
context.TODO() in test files - t.Context() should be used instead.
The rules only apply to *_test.go files, not production code.
Note: os.Setenv is not covered by forbidigo due to a limitation where
it only catches calls when the return value is assigned. However,
errcheck will flag unchecked os.Setenv calls.
Assisted-By: cagent
Signed-off-by: David Gageot <[email protected]>
Use t.TempDir() which automatically cleans up the temporary directory
when the test completes, eliminating the need for manual cleanup.
Go 1.14 modernization pattern.
Assisted-By: cagent
Signed-off-by: David Gageot <[email protected]>
Use t.Setenv() which automatically restores the original value when
the test completes, eliminating the need for manual cleanup.
Go 1.18 modernization pattern.
Assisted-By: cagent
Signed-off-by: David Gageot <[email protected]>
Replace manual context creation with t.Context() which is automatically
cancelled when the test completes.
Go 1.24 modernization pattern.
Assisted-By: cagent
Signed-off-by: David Gageot <[email protected]>
Ensured all watcher and sync goroutines and channels are robustly closed on context cancellation or error.
Added explicit logging for large batches and context cancellation to prevent stuck processes and ensure graceful shutdown on Ctrl-C.
Signed-off-by: Amol Yadav <[email protected]>
Currently when using models, the final message is 'confugiring' which could let users think the DMR configuration is still pending
Signed-off-by: Guillaume Lours <[email protected]>
# Conflicts:
# pkg/api/event.go