Commit Graph

1385 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
8b769bad6b pkg/compose: remove dependency on github.com/docker/buildx/driver
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 <github@gone.nl>
2026-01-29 15:59:03 +01:00
Nicolas De Loof
671507a8b3 fix panic
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-01-29 09:57:49 +01:00
ibrahim yapar
56ab28aef3 compose: recreate container when mounted image digest changes
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 <74625807+ibrahimypr@users.noreply.github.com>
2026-01-26 15:55:44 +01:00
Nepomuk Crhonek
d5bb3387ca Fix potential nil pointer dereference in container event monitoring
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 <105591323+Nepomuk5665@users.noreply.github.com>
2026-01-25 21:15:37 +01:00
Sebastiaan van Stijn
c51b1fea29 replace some uses of strings.Split(N) for strings.Cut
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-22 11:26:16 +01:00
Mahesh Thakur
a061c17736 fix: emit container status events after network reconnection
Signed-off-by: Mahesh Thakur <maheshthakur9152@gmail.com>
2026-01-21 09:40:05 +01:00
David Gageot
04b4a832dc chore(lint): add forbidigo rules to enforce t.Context() in tests
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 <david.gageot@docker.com>
2026-01-20 11:34:11 +01:00
David Gageot
27faa3b84e test: replace os.MkdirTemp with t.TempDir()
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 <david.gageot@docker.com>
2026-01-20 11:34:11 +01:00
David Gageot
bcc0401e0e test: replace os.Setenv with t.Setenv()
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 <david.gageot@docker.com>
2026-01-20 11:34:11 +01:00
David Gageot
093205121c test: replace context.Background()/context.TODO() with t.Context()
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 <david.gageot@docker.com>
2026-01-20 11:34:11 +01:00
Amol Yadav
b92b87dd9c fix: robustly handle large file change batches in watch mode
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 <amyssnipet@yahoo.com>
2026-01-20 08:34:15 +01:00
hiroto.toyoda
d7bdb34ff5 refactor(attach): remove unused stdin from getContainerStream
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-19 17:46:55 +01:00
hiroto.toyoda
79d7a8acd6 refactor(attach): simplify attachContainerStreams signature
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-19 17:46:55 +01:00
hiroto.toyoda
abd99be4fd refactor(attach): remove unused detach watcher and keep attach behavior
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-19 17:46:55 +01:00
hiroto.toyoda
2672d34217 Improve error handling in attach.go
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-19 17:46:55 +01:00
Stavros Kois
2f108ffaa8 handle healthcheck.disable true in isServiceHealthy
Signed-off-by: Stavros Kois <s.kois@outlook.com>
2026-01-19 10:18:34 +01:00
hiroto.toyoda
b760afaf9f refactor: extract API version constants to dedicated file
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-11 17:04:40 +01:00
Nicolas De Loof
ec88588cd8 Removed build warning when no explicit build has been requested.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-01-05 13:17:20 +01:00
hiroto.toyoda
ee4c01b66b fix: correctly use errgroup.WithContext
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-05 09:27:46 +01:00
hiroto.toyoda
d7a65f53f8 fix: correct typo in isSwarmEnabled method name
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-05 09:11:58 +01:00
hiroto.toyoda
4520bcbaf6 fix: clean up temporary compose files after conversion
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
2026-01-05 09:01:56 +01:00
Ignacio López Luna
59f04b85af remove duplicated version field
Signed-off-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
2025-12-18 15:24:06 +01:00
Ignacio López Luna
b4574c8bd6 do not strip build metadata
Signed-off-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
2025-12-18 15:24:06 +01:00
Ignacio López Luna
29d6c918c4 use github.com/docker/docker/api/types/versions for comparing versions and store plugin version obtained by pluginManager in newModelAPI
Signed-off-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
2025-12-18 15:24:06 +01:00
Ignacio López Luna
58403169f3 Only append RuntimeFlags if docker model CLI version is >= v1.0.6
Signed-off-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
2025-12-18 15:24:06 +01:00
Ignacio López Luna
6aee7f8370 gets back runtime flags when configuring models
Signed-off-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
2025-12-18 15:24:06 +01:00
Nicolas De Loof
c89b8a2d6b warn user no service has been selected to build
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-18 11:35:33 +01:00
Nicolas De Loof
aec9f54176 check model plugin is successfully loaded and store version
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-18 11:01:35 +01:00
Nicolas De Loof
8e5b25c0f1 Restored support for BUILDKIT_PROGRESS.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-15 18:03:04 +01:00
Nicolas De Loof
d4c1987638 Prevented incorrect progress metrics to break compose display.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-15 18:02:31 +01:00
Nicolas De Loof
e22426443e Introduced fsnotify build tag to select watcher implementation
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-15 10:16:12 +01:00
Guillaume Lours
6599f8ad84 add 'configured' event at the end of model configuration phase
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 <705411+glours@users.noreply.github.com>

# Conflicts:
#	pkg/api/event.go
2025-12-15 10:14:21 +01:00
Nicolas De Loof
02008a0097 Restored image layer download progress details on pull.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-12 14:22:02 +01:00
xiaolinny
0878c59a74 chore: fix grammatical errors and improve clarity in code
Signed-off-by: xiaolinny <xiaolincode@outlook.com>
2025-12-08 11:20:48 +01:00
Nicolas De Loof
c0345e4f45 restore support for COMPOSE_COMPATIBILITY
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-07 18:42:04 +01:00
yangfeiyu
000a4a4b9f check buildx version before comparing it
Signed-off-by: yangfeiyu <yangfeiyu20102011@163.com>
2025-12-04 08:34:13 +01:00
zjumathcode
13d70b1c11 refactor: replace interface{} with any for clarity and modernization
Signed-off-by: zjumathcode <pai314159@2980.com>
2025-12-02 08:41:49 +01:00
Nicolas De Loof
72f4d655ef Bump compose go to v2.10.0
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-01 17:19:40 +01:00
Sebastiaan van Stijn
dc66e6bad1 golangci-lint: use gci formatter instead of goimports
Most files already grouped imports into "stdlib -> other -> local",
but some files didn't. The gci formatter is similar to goimports, but
has better options to make sure imports are grouped in the expected
order (and to make sure no additional groups are present).

This formatter has a 'fix' function, so code can be re-formatted auto-
matically;

    golangci-lint run -v --fix

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-01 12:21:50 +01:00
Ignacio López Luna
af8cac5768 just warn user
Signed-off-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
2025-11-28 18:52:36 +01:00
Ignacio Lopez
8477a85ce6 feat(model): reject runtime flags in model configuration
Signed-off-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
2025-11-28 18:52:36 +01:00
Nicolas De Loof
e0977c2df1 only check for env_file
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-28 09:48:55 +01:00
Nicolas De Loof
2d569916fe skip includes preparing publish
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-28 09:41:43 +01:00
liuyueyangxmu
3975f02153 refactor: use strings.Builder to improve performance
Signed-off-by: liuyueyangxmu <liuyueyangxmu@outlook.com>
2025-11-26 10:52:24 +01:00
Nicolas De Loof
fa832d72d7 Added support for build.no_cache_filter
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-26 09:37:04 +01:00
vicerace
822f5a702b refactor: replace Split in loops with more efficient SplitSeq
Signed-off-by: vicerace <vicerace@sohu.com>
2025-11-25 11:37:03 +01:00
Nicolas De Loof
6f365395e5 Fix support for port range
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-16 20:38:54 +01:00
Sebastiaan van Stijn
c47b8c32e3 Dockerfile: update golangci-lint to v2.6.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-16 14:54:58 +01:00
Sebastiaan van Stijn
89d3944837 fix linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-16 14:54:58 +01:00
Nicolas De Loof
d7e5f20eb6 images command should display image Created time or N/A if not available
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-13 09:40:56 +01:00