containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
7.86k stars 585 forks source link

--restart always has different effects in docker vs. nerdctl #2991

Open apostasie opened 3 months ago

apostasie commented 3 months ago

Description

When starting a container with --restart always, docker will not try to restart if explicitly stopped.

On the other hand, nerdctl will

Steps to reproduce the issue

sudo ./nerdctl run -d --name restarttest --restart always debian sleep 3600
sudo ./nerdctl stop restarttest
docker run -d --name restarttest --restart always debian sleep 3600
docker stop restarttest

Now, give it a few seconds then:

sudo ./nerdctl ps | grep restarttest
docker ps | grep restarttest

Describe the results you received and expected

With nerdctl, container has been restarted.

With docker, it has not.

What version of nerdctl are you using?

1.7.6

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

apostasie commented 3 months ago

See docker documentation here:

https://docs.docker.com/config/containers/start-containers-automatically/

Specifically:

"always Always restart the container if it stops. If it's manually stopped, it's restarted only when Docker daemon restarts or the container itself is manually restarted."