Skip to content

Conversation

@stavros-k
Copy link
Contributor

@stavros-k stavros-k commented Jan 5, 2026

Closes #13522

Func ToMobyHealthCheck converts disabled helthchecks to []string{"NONE"}.
Made changes in isServiceHealthy, to also consider the above as "no healthecheck", as it will never be nil

	if check.Disable {
		test = []string{"NONE"}
	}

Additionally added some unit tests. To be honest, the tests ONLY were generated by AI.

Related downstream issue: getarcaneapp/arcane#1338


I used the following code to test. Before my changes it would fail, after my changes, not.

services:
  whoami:
    image: ghcr.io/traefik/whoami:v1.11.0@sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab

  another:
    image: ghcr.io/traefik/whoami:v1.11.0@sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab
    healthcheck:
      disable: true
package main

import (
	"context"
	"fmt"
	"os"
	"os/signal"
	"path/filepath"
	"syscall"
	"time"

	"github.com/docker/cli/cli/command"
	"github.com/docker/cli/cli/flags"
	"github.com/docker/compose/v5/pkg/api"
	"github.com/docker/compose/v5/pkg/compose"
)

func main() {
	ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
	defer cancel()

	// Create Docker CLI
	dockerCli, err := command.NewDockerCli()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to create Docker CLI: %v\n", err)
		os.Exit(1)
	}

	// Initialize Docker CLI
	if err := dockerCli.Initialize(flags.NewClientOptions()); err != nil {
		fmt.Fprintf(os.Stderr, "Failed to initialize Docker CLI: %v\n", err)
		os.Exit(1)
	}

	// Create compose service
	service, err := compose.NewComposeService(dockerCli)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to create compose service: %v\n", err)
		os.Exit(1)
	}

	// Get absolute path to compose file
	composeFile, err := filepath.Abs("test-compose.yaml")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to get absolute path: %v\n", err)
		os.Exit(1)
	}

	workingDir := filepath.Dir(composeFile)

	// Load project
	fmt.Printf("Loading project from %s\n", composeFile)
	project, err := service.LoadProject(ctx, api.ProjectLoadOptions{
		ConfigPaths: []string{composeFile},
		WorkingDir:  workingDir,
		ProjectName: "test",
	})
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to load project: %v\n", err)
		os.Exit(1)
	}

	fmt.Printf("Project loaded: %s\n", project.Name)
	fmt.Printf("Services: %v\n", project.ServiceNames())

	// Start services
	fmt.Println("Starting services...")
	err = service.Up(ctx, project, api.UpOptions{
		Create: api.CreateOptions{
			Services:             project.ServiceNames(),
			RemoveOrphans:        true,
			Recreate:             api.RecreateDiverged,
			RecreateDependencies: api.RecreateDiverged,
		},
		Start: api.StartOptions{
			Project:     project,
			Services:    project.ServiceNames(),
			Wait:        true,
			WaitTimeout: 2 * time.Minute,
			OnExit:      api.CascadeFail,
		},
	})
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to start services: %v\n", err)
		os.Exit(1)
	}

	fmt.Println("Services started successfully!")
	fmt.Println("\nPress Ctrl+C to stop services...")

	// Wait for signal
	<-ctx.Done()

	fmt.Println("\nStopping services...")
	stopCtx := context.Background()
	err = service.Down(stopCtx, project.Name, api.DownOptions{
		RemoveOrphans: true,
	})
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to stop services: %v\n", err)
		os.Exit(1)
	}

	fmt.Println("Services stopped successfully!")
}

@stavros-k stavros-k requested a review from a team as a code owner January 5, 2026 09:40
@stavros-k stavros-k requested review from glours and ndeloof January 5, 2026 09:40
Signed-off-by: Stavros Kois <s.kois@outlook.com>
@ndeloof ndeloof enabled auto-merge (rebase) January 19, 2026 09:08
@ndeloof ndeloof merged commit 2f108ff into docker:main Jan 19, 2026
24 checks passed
@stavros-k stavros-k deleted the issvchealthy branch January 19, 2026 09:19
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 22, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [docker/compose](https://github.com/docker/compose) | patch | `v5.0.1` → `v5.0.2` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>docker/compose (docker/compose)</summary>

### [`v5.0.2`](https://github.com/docker/compose/releases/tag/v5.0.2)

[Compare Source](docker/compose@v5.0.1...v5.0.2)

#### What's Changed

##### 🐛 Fixes

- Fixed progress UI to adapt to terminal width by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13519](docker/compose#13519)
- Removed warning when no explicit build has been requested. by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13493](docker/compose#13493)
- Restored `runtime_flags` support in `models` by [@&#8203;ilopezluna](https://github.com/ilopezluna) in [#&#8203;13460](docker/compose#13460)
- Added service name completion to `down` command by [@&#8203;bmo-at](https://github.com/bmo-at) in [#&#8203;13470](docker/compose#13470)
- Fixed tilde in `--env-file` paths expanded to user home directory by [@&#8203;tensorworkerr](https://github.com/tensorworkerr) in [#&#8203;13510](docker/compose#13510)
- Handle `healthcheck.disable: true` by [@&#8203;stavros-k](https://github.com/stavros-k) in [#&#8203;13494](docker/compose#13494)
- Fixed shutdown and error handling for large file change batches in `watch` by [@&#8203;amyssnippet](https://github.com/amyssnippet) in [#&#8203;13525](docker/compose#13525)

##### 🔧  Internal

- Added unit test for upOptions.OnExit method by [@&#8203;htoyoda18](https://github.com/htoyoda18) in [#&#8203;13489](docker/compose#13489)
- clean up temporary compose files after conversion by [@&#8203;htoyoda18](https://github.com/htoyoda18) in [#&#8203;13483](docker/compose#13483)
- Fixed typo in isSwarmEnabled method name by [@&#8203;htoyoda18](https://github.com/htoyoda18) in [#&#8203;13481](docker/compose#13481)
- Fixed incorrect usage of errgroup.WithContext by [@&#8203;htoyoda18](https://github.com/htoyoda18) in [#&#8203;13480](docker/compose#13480)
- Fixed timeout initialization when waitTimeout is zero by [@&#8203;htoyoda18](https://github.com/htoyoda18) in [#&#8203;13471](docker/compose#13471)
- Extracted API version constants to dedicated file by [@&#8203;htoyoda18](https://github.com/htoyoda18) in [#&#8203;13503](docker/compose#13503)
- Replace tabbed indentation in sdk.md by [@&#8203;pkqk](https://github.com/pkqk) in [#&#8203;13505](docker/compose#13505)
- Improved attach error handling and cleanup by [@&#8203;htoyoda18](https://github.com/htoyoda18) in [#&#8203;13488](docker/compose#13488)
- Modernize tests by [@&#8203;dgageot](https://github.com/dgageot) in [#&#8203;13531](docker/compose#13531)
- set fsnotify build tag when building for OSX by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13532](docker/compose#13532)

##### ⚙️ Dependencies

- build(deps): bump github.com/klauspost/compress to v1.18.2 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13499](docker/compose#13499)
- go.mod: remove exclude rules by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13498](docker/compose#13498)
- build(deps): bump github.com/containerd/containerd/v2 to v2.2.1 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13497](docker/compose#13497)
- build(deps): bump golang.org/x/sys from 0.39.0 to 0.40.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13502](docker/compose#13502)
- build(deps): bump google.golang.org/grpc from 1.77.0 to 1.78.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13475](docker/compose#13475)
- build(deps): bump github.com/go-viper/mapstructure/v2 from 2.4.0 to 2.5.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13506](docker/compose#13506)
- build(deps): bump github.com/sirupsen/logrus v1.9.4 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13518](docker/compose#13518)
- Bump compose to v2.10.1 by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13528](docker/compose#13528)

#### New Contributors

- [@&#8203;bmo-at](https://github.com/bmo-at) made their first contribution in [#&#8203;13470](docker/compose#13470)
- [@&#8203;pkqk](https://github.com/pkqk) made their first contribution in [#&#8203;13505](docker/compose#13505)
- [@&#8203;tensorworkerr](https://github.com/tensorworkerr) made their first contribution in [#&#8203;13510](docker/compose#13510)
- [@&#8203;stavros-k](https://github.com/stavros-k) made their first contribution in [#&#8203;13494](docker/compose#13494)
- [@&#8203;amyssnippet](https://github.com/amyssnippet) made their first contribution in [#&#8203;13525](docker/compose#13525)
- [@&#8203;dgageot](https://github.com/dgageot) made their first contribution in [#&#8203;13531](docker/compose#13531)

**Full Changelog**: <docker/compose@v5.0.1...v5.0.2>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44Ni4xIiwidXBkYXRlZEluVmVyIjoiNDIuODYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] container [name] has no healthcheck configured when healthcheck.disabled = true

2 participants