Commit graph

1429 commits

Author SHA1 Message Date
Nicolas De loof
659b269e52 nit: use labelFilter consistently in filters.go
Some checks failed
ci / validate (lint) (push) Has been cancelled
ci / validate (validate-docs) (push) Has been cancelled
ci / validate (validate-go-mod) (push) Has been cancelled
ci / validate (validate-headers) (push) Has been cancelled
ci / binary (push) Has been cancelled
ci / bin-image-test (push) Has been cancelled
ci / test (push) Has been cancelled
ci / e2e (plugin, oldstable) (push) Has been cancelled
ci / e2e (standalone, oldstable) (push) Has been cancelled
ci / e2e (plugin, stable) (push) Has been cancelled
ci / e2e (standalone, stable) (push) Has been cancelled
merge / bin-image-prepare (push) Has been cancelled
merge / module-image (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
ci / binary-finalize (push) Has been cancelled
ci / coverage (push) Has been cancelled
ci / release (push) Has been cancelled
merge / bin-image (push) Has been cancelled
merge / desktop-edge-test (push) Has been cancelled
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
5c70712199 fix: restore deprecated Set.Clear/Union; use resource var in pull.go
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
07832c4df1 refactor: fix lint issues from cleanup changes
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
40d363baf9 refactor: miscellaneous small cleanups (forEach, filters, Set)
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
98163f5616 refactor(compose): collapse resolveSharedNamespaces repeated blocks
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
96cb057d04 refactor(compose): extract forEachContainerConcurrent to deduplicate pause/kill logic
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
c8325dd0d4 refactor(compose): extract removeResource helper in down.go
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
0eb2e4f4e0 refactor(compose): remove redundant wrapper funcs in dependencies.go
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Nicolas De loof
da530c7233 refactor(compose): collapse trivial event-helper wrappers in progress.go
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
2026-05-12 11:31:40 +02:00
Sebastiaan van Stijn
88545507e8 pkg/compose: go fix
Some checks are pending
ci / validate (lint) (push) Waiting to run
ci / validate (validate-docs) (push) Waiting to run
ci / validate (validate-go-mod) (push) Waiting to run
ci / validate (validate-headers) (push) Waiting to run
ci / binary (push) Waiting to run
ci / binary-finalize (push) Blocked by required conditions
ci / bin-image-test (push) Waiting to run
ci / test (push) Waiting to run
ci / e2e (plugin, oldstable) (push) Waiting to run
ci / e2e (standalone, oldstable) (push) Waiting to run
ci / e2e (plugin, stable) (push) Waiting to run
ci / e2e (standalone, stable) (push) Waiting to run
ci / coverage (push) Blocked by required conditions
ci / release (push) Blocked by required conditions
merge / bin-image-prepare (push) Waiting to run
merge / bin-image (push) Blocked by required conditions
merge / module-image (push) Waiting to run
merge / desktop-edge-test (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-05-11 13:40:24 +02:00
Guillaume Lours
9eb8966705 fix: provider output handling and watch rebuild re-invocation
Provider info and error messages containing newlines broke the TTY
progress display (timer drifting to a new line, broken cursor
movement). Extract only the first line for progress events via
firstLine(). Full messages remain available through the provider's
own debug message type.

Skip provider services during watch rebuild convergence by adding a
SkipProviders flag to CreateOptions, set only by the watch rebuild
path. This prevents unnecessary re-invocation of providers on every
file change while preserving normal provider execution for all other
commands (up, create, run, scale).

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-04-14 11:43:48 +02:00
Guillaume Lours
182defa8aa feat: add Docker Desktop Logs view hints and navigation shortcut
Add CLI hooks handler to show "What's next:" hints pointing to the
Docker Desktop Logs view after `docker logs`, `docker compose logs`,
and `docker compose up -d`.

Add `l` keyboard shortcut in the `compose up` navigation menu to
open the Logs view, gated on Docker Desktop feature flag and settings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-04-10 15:26:08 +02:00
Guillaume Lours
ba417e4392 use new moby/moby modules instead of docker/docker dependency
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-04-08 08:50:50 +02:00
Sebastiaan van Stijn
89e3517f29 build(deps): bump github.com/docker/cli v29.4.0
full diff: https://github.com/docker/cli/compare/v29.3.1...v29.4.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-07 12:21:18 +02:00
Ishwar
1e3f4d0f4a fix: update e2e tests to expect exit code 130 on user decline
Signed-off-by: Ishwar <ishwarcm@iitbhilai.ac.in>
2026-03-31 20:35:07 +02:00
Ishwar
37cbf7a9cd test: repurpose decline test to cover sensitive data detection path
Renames test to Test_preChecks_sensitive_data_detected_decline. Uses a temporary .env file with an AWS token to reliably trigger the DefangLabs secret detector, and confirms that preChecks correctly aborts early on user decline.

Signed-off-by: Ishwar <ishwarcm@iitbhilai.ac.in>
2026-03-31 20:35:07 +02:00
Ishwar
9c5fd50989 publish: return ErrPublishAborted when user declines interactive prompts
Signed-off-by: Ishwar <ishwarcm@iitbhilai.ac.in>
2026-03-31 20:35:07 +02:00
Ricardo Branco
73d8a6d57d test: use random host port for dind TLS build test
Signed-off-by: Ricardo Branco <rbranco@suse.de>
2026-03-31 19:10:35 +02:00
Sebastiaan van Stijn
92a7ac1fa2 fix mixed assertion libraries in tests
Before this, assertion libraries were mixed, sometimes
even in the same file.

    git grep -l '"gotest.tools/v3/' | wc -l
    75
    git grep -l '"github.com/stretchr/testify' | wc -l
    24

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-31 17:32:51 +02:00
jarek
a97738de7d fix: add NetworkConnect fallback for API < 1.44
For Docker daemons older than API 1.44, the extra networks omitted from
ContainerCreate must be connected individually after creation via
NetworkConnect. If any NetworkConnect call fails, remove the freshly
created container to prevent orphans.

Add two tests:
- TestCreateMobyContainerLegacyAPI: happy path verifying NetworkConnect
  is called for the secondary network on API 1.43
- TestCreateMobyContainerLegacyAPI_NetworkConnectFailure: verifies
  ContainerRemove is called with Force when NetworkConnect fails

Signed-off-by: jarek <jkrochmalski@gmail.com>
2026-03-31 15:44:00 +02:00
jarek
3b1004c4d9 fix: gate extra EndpointsConfig behind API >= 1.44
Before API 1.44 (Docker Engine 25.0), ContainerCreate only accepted a
single EndpointsConfig entry. Passing multiple entries silently drops
all but one network, leaving containers under-connected on older daemons
such as Docker 20.10 or Synology DSM 7.1/7.2.

Add apiVersion144 constant and wrap the secondary-networks loop in
defaultNetworkSettings so that only the primary network is included in
the ContainerCreate call when the negotiated API version is below 1.44.

Signed-off-by: jarek <jkrochmalski@gmail.com>
2026-03-31 15:44:00 +02:00
Guillaume Lours
9cab43945a refactor: merge RuntimeVersion and CurrentAPIVersion into RuntimeAPIVersion
After API negotiation, Compose should only rely on the negotiated version
and never use the daemon's raw max version for request shaping. Merge both
functions into a single RuntimeAPIVersion that negotiates via Ping and
returns ClientVersion, erroring if the client reports an empty version
instead of silently falling back to ServerVersion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-03-31 14:39:37 +02:00
Guillaume Lours
ef836856fe fix: don't cache transient errors in version negotiation
Replace sync.Once with sync.Mutex so that only successful version
lookups are cached. Errors (context cancellation, network blips) are
returned without caching, allowing subsequent calls to retry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-03-31 14:39:37 +02:00
Guillaume Lours
c7d1a6030e fix: use pointer receivers for composeService methods with sync.Once fields
Moving runtimeVersionCache from a package-level var to instance fields on
composeService caused copylocks violations in methods using value receivers,
since sync.Once contains sync.noCopy. Switch the 4 affected methods to
pointer receivers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-03-31 14:39:37 +02:00
Guillaume Lours
5f6f35ed22 pkg/compose: use negotiated API version for request shaping
Move runtimeVersionCache from a package-level var to per-instance fields
on composeService and add CurrentAPIVersion() that negotiates via Ping
before returning the client version.

Switch getCreateConfigs and buildContainerVolumes to use
CurrentAPIVersion so that version-gated request shaping matches what
the daemon actually validates against (the negotiated API version from
the request path, not the server's max capability).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-03-31 14:39:37 +02:00
pawannn
e5c6b9c3b7 fix: return error from ExecStart instead of nil in runWaitExec
Signed-off-by: pawannn <pawankalyan1614@gmail.com>
2026-03-30 16:06:26 +02:00
pawannn
b529a3ca5b fix: add build tag to hook_test.go to fix Windows build failure (#13682)
Signed-off-by: pawannn <pawankalyan1614@gmail.com>
2026-03-30 16:06:26 +02:00
Sebastiaan van Stijn
5bbdd239df pkg/compose: fix TestRunHook_ConsoleSize on macOS
containerd/console is broken on macOS, and panics; use creack/pty
instead for this test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-30 09:43:35 +02:00
Mohamed-Moumni
e742d09711 fix: initialize and pass envFiles map in processExtends
Signed-off-by: Mohamed-Moumni <mohamedmoumni593@gmail.com>
2026-03-27 16:02:01 +01:00
Samaresh Kumar Singh
612b8c567e fix: preserve ssh:// URL scheme in dockerFilePath
filepath.Join cleans its arguments, collapsing the double slash in
ssh:// URLs to a single slash (ssh:/), corrupting the scheme before
it reaches buildx. Return the dockerfile as-is for any URL-schemed
context, matching the existing behaviour for git:// and https:// URLs.

Fixes the issue #13668

Signed-off-by: Samaresh Kumar Singh <ssam3003@gmail.com>
2026-03-27 10:12:59 +01:00
CodeLoopdroid
a57320fdf5 Fix up attach filtering
Signed-off-by: CodeLoopdroid <214800619+CodeLoopdroid@users.noreply.github.com>
2026-03-25 10:07:02 +01:00
Ishwar
b18354b9f4 refactor: thread context through publish sensitive data check
Signed-off-by: Ishwar <ishwarcm@iitbhilai.ac.in>
2026-03-23 12:10:25 +01:00
Nicolas De Loof
5de4353a6a bump golangci-lint to latest and configure CLAUDE to use it on change
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-03-23 11:33:52 +01:00
Michael Irwin
4915b775ee fix: only pass ConsoleSize to ExecAttach when TTY is enabled
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 <michael.irwin@docker.com>

Resolves #13615
2026-03-04 19:53:35 +01:00
Varun Chawla
81d7d3c60b fix: execute post_start hooks in docker compose run
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 <varun_6april@hotmail.com>
2026-02-23 08:58:31 +01:00
Sebastiaan van Stijn
f9828dfab9 modernize some code
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 <github@gone.nl>
2026-02-12 15:31:35 +01:00
Sebastiaan van Stijn
da691c7cc1 pkg/compose: un-export consts
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 <github@gone.nl>
2026-02-11 22:26:15 +01:00
Sebastiaan van Stijn
fefdc95224 pkg/compose: defaultNetworkSettings: slight refactor
- 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 <github@gone.nl>
2026-02-11 15:14:49 +01:00
Sebastiaan van Stijn
08c32e9033 pkg/compose: defaultNetworkSettings: return early for unsupported feature
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-11 15:14:49 +01:00
Sebastiaan van Stijn
bdb630fb89 pkg/compose: format layer push progress
Format layer progress details with minimal efforts as new UI does
not render individual layers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-11 12:32:37 +01:00
Nicolas De Loof
3697b128a1 pkg/compose: format layer pull progress
Format layer progress details with minimal efforts as new UI
does not render individual layers

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-11 12:32:37 +01:00
Sebastiaan van Stijn
b285e48976 pkg/compose: remove unused consts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-11 12:32:37 +01:00
Sebastiaan van Stijn
8193d86d2f pkg/bridge: remove uses of go-connections
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-11 12:32:37 +01:00
Sebastiaan van Stijn
bfb5511d0d go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2
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 <github@gone.nl>
2026-02-11 12:32:37 +01:00
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