Skip to content

Fix RestartPolicy.noRestart() so it can disable restart on existing containers - #2674

Open
jcongithub wants to merge 1 commit into
docker-java:mainfrom
jcongithub:fix/restart-policy-norestart-update
Open

Fix RestartPolicy.noRestart() so it can disable restart on existing containers#2674
jcongithub wants to merge 1 commit into
docker-java:mainfrom
jcongithub:fix/restart-policy-norestart-update

Conversation

@jcongithub

Copy link
Copy Markdown

noRestart() returned a policy with an empty Name (""), which the Docker Engine update endpoint ignores: it only applies RestartPolicy when Name != "". As a result an existing container could not be switched from always/on-failure back to no-restart via updateContainerCmd.

Return Name "no" instead - a valid "none" policy (RestartPolicy.IsNone() is true for both "" and "no") that the daemon actually applies. Update RestartPolicySerializingTest to match; this also matches what modern Docker sends for docker run --restart no.

…ontainers

noRestart() returned a policy with an empty Name (""), which the Docker Engine
update endpoint ignores: it only applies RestartPolicy when Name != "". As a
result an existing container could not be switched from always/on-failure back
to no-restart via updateContainerCmd.

Return Name "no" instead - a valid "none" policy (RestartPolicy.IsNone() is true
for both "" and "no") that the daemon actually applies. Update
RestartPolicySerializingTest to match; this also matches what modern Docker sends
for `docker run --restart no`.
@jcongithub
jcongithub requested a review from a team as a code owner August 17, 2026 02:42
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.

1 participant