Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nerdctl create --restart=unless-stopped restart policy behaviour inconsistent with docker #2308

Merged

Conversation

yankay
Copy link
Contributor

@yankay yankay commented Jun 16, 2023

The PR is to fix the #2270 by using the containerd.io/restart.status label.

In containerd the label is used as the desiredStatus : https://github.com/containerd/containerd/blob/main/runtime/restart/monitor/monitor.go#L152

After Fixed:

#  ./_output/nerdctl create --restart=always docker.m.daocloud.io/nginx
c59503699e2319491f398669a47697ead68ac081ee44afd431f7a684cc3221c1
#  ./_output/nerdctl run -d --restart=always docker.m.daocloud.io/nginx
fb95a1146e94d47b6441da6082b530b7d639d713e8c7d067e20cf4a6e2b7384f
# ./_output/nerdctl ps -a |grep nginx
c59503699e23    docker.m.daocloud.io/nginx:latest                             "/docker-entrypoint.…"    17 seconds ago    Created             nginx-c5950
fb95a1146e94    docker.m.daocloud.io/nginx:latest                             "/docker-entrypoint.…"    17 seconds ago    Up                  nginx-fb95

The container would not start after being created with the restart policy. The behavior is consistent with docker

@yankay yankay force-pushed the fix-restart-policy-behaviour-inconsistent branch 2 times, most recently from 5c4f460 to 958ce5a Compare June 16, 2023 09:59
@yankay yankay changed the title Fix restart policy behaviour inconsistent Fix nerdctl create --restart=unless-stopped restart policy behaviour inconsistent Jun 16, 2023
@yankay yankay changed the title Fix nerdctl create --restart=unless-stopped restart policy behaviour inconsistent Fix nerdctl create --restart=unless-stopped restart policy behaviour inconsistent with docker Jun 16, 2023
Signed-off-by: Kay Yan <kay.yan@daocloud.io>
@yankay yankay force-pushed the fix-restart-policy-behaviour-inconsistent branch from 958ce5a to c12e17f Compare June 16, 2023 10:30
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda added this to the v1.5.0 milestone Jun 16, 2023
@AkihiroSuda AkihiroSuda merged commit 3fa8d7d into containerd:main Jun 16, 2023
21 checks passed
@yankay
Copy link
Contributor Author

yankay commented Jun 20, 2023

Thank you @AkihiroSuda for the PR review

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.

nerdctl create --restart=unless-stopped behaviour is inconsistent with docker
2 participants