{"id":"3ccd24350d0832ce","repo":"docker/cli","slug":"no-healthcheck-conflicts-with-health-options","errorCode":null,"errorMessage":"--no-healthcheck conflicts with --health-* options","messagePattern":"--no-healthcheck conflicts with --health-\\* options","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":570,"sourceCode":"\n\tsecurityOpts, maskedPaths, readonlyPaths := parseSystemPaths(securityOpts)\n\n\tstorageOpts, err := parseStorageOpts(copts.storageOpt.GetSlice())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Healthcheck\n\tvar healthConfig *container.HealthConfig\n\thaveHealthSettings := copts.healthCmd != \"\" ||\n\t\tcopts.healthInterval != 0 ||\n\t\tcopts.healthTimeout != 0 ||\n\t\tcopts.healthStartPeriod != 0 ||\n\t\tcopts.healthRetries != 0 ||\n\t\tcopts.healthStartInterval != 0\n\tif copts.noHealthcheck {\n\t\tif haveHealthSettings {\n\t\t\treturn nil, errors.New(\"--no-healthcheck conflicts with --health-* options\")\n\t\t}\n\t\thealthConfig = &container.HealthConfig{Test: []string{\"NONE\"}}\n\t} else if haveHealthSettings {\n\t\tvar probe []string\n\t\tif copts.healthCmd != \"\" {\n\t\t\tprobe = []string{\"CMD-SHELL\", copts.healthCmd}\n\t\t}\n\t\tif copts.healthInterval < 0 {\n\t\t\treturn nil, errors.New(\"--health-interval cannot be negative\")\n\t\t}\n\t\tif copts.healthTimeout < 0 {\n\t\t\treturn nil, errors.New(\"--health-timeout cannot be negative\")\n\t\t}\n\t\tif copts.healthRetries < 0 {\n\t\t\treturn nil, errors.New(\"--health-retries cannot be negative\")\n\t\t}\n\t\tif copts.healthStartPeriod < 0 {\n\t\t\treturn nil, errors.New(\"--health-start-period cannot be negative\")","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/opts.go#L552-L588","documentation":"When --no-healthcheck is set, the CLI checks whether any health-related flag (--health-cmd, --health-interval, --health-timeout, --health-start-period, --health-retries, --health-start-interval) was also given (opts.go:562-571). Since --no-healthcheck writes a HealthConfig of Test=[\"NONE\"] that disables checks entirely, combining it with health tuning flags is contradictory and rejected.","triggerScenarios":"`docker run --no-healthcheck --health-cmd 'curl -f localhost' ...` or any combination of --no-healthcheck with a non-zero/non-empty --health-* flag on run/create. Note haveHealthSettings triggers on any non-zero value, so even --health-retries=1 alongside --no-healthcheck errors.","commonSituations":"Templated CI/compose-to-run conversions that emit both flags conditionally; adding --no-healthcheck to silence a noisy image healthcheck while leaving old --health-* overrides in the script; wrapper scripts that always append default health flags.","solutions":["Remove the --health-* flags if you intend to disable the healthcheck with --no-healthcheck","Remove --no-healthcheck if you intend to override the image's healthcheck with custom --health-* settings","In templating, make the two option groups mutually exclusive branches"],"exampleFix":"# before\ndocker run --no-healthcheck --health-interval=30s myimage\n# after (disable entirely)\ndocker run --no-healthcheck myimage\n# or (customize instead)\ndocker run --health-interval=30s myimage","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","healthcheck","conflicting-options","container-create"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}