docker/cli ยท error
invalid restart policy format: maximum retry count must be a
Error message
invalid restart policy format: maximum retry count must be an integer
What it means
Error "invalid restart policy format: maximum retry count must be an integer" thrown in docker/cli.
Source
Thrown at opts/parse.go:96
// retry count, if set, must be an integer (negative values are allowed here
// but may be rejected by the daemon).
func ParseRestartPolicy(policy string) (container.RestartPolicy, error) {
if policy == "" {
// For backward compatibility, do not set an explicit default ("no"),
// as older daemons may not support it.
return container.RestartPolicy{}, nil
}
name, count, ok := strings.Cut(policy, ":")
if ok && name == "" {
return container.RestartPolicy{}, errors.New("invalid restart policy format: no policy provided before colon")
}
var retryCount int
if count != "" {
c, err := strconv.Atoi(count)
if err != nil {
return container.RestartPolicy{}, errors.New("invalid restart policy format: maximum retry count must be an integer")
}
retryCount = c
}
return container.RestartPolicy{
Name: container.RestartPolicyMode(name),
MaximumRetryCount: retryCount,
}, nil
}
View on GitHub (pinned to e9452d6e78)
When it happens
Trigger: Thrown at opts/parse.go:96 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/5739ca55c02b128e.json.
Report an issue: GitHub.