containerd / containerd/nerdctl
nerdctl compose stop will restart containers if restart=always
- Dominant language
- Go
- Stars
- 10.4k
- Forks
- 826
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 44
Description
### Description
when creating containers by nerdctl compose, setting `restart: always`, then using `nerdctl compose stop` to stop the containers, it disappears for a while, but then reappear.
checked `docker compose` locally, and docs https://docs.docker.com/config/containers/start-containers-automatically/#restart-policy-details, if users manually stop the containers, it will not restart automatically.
is this working as expected, or we can improve this?
by the way, I have checked the nerdctl source code, and compose is using `Stop` to stop containers, so the question became should if containers should be restarted if manually stopped
I also checked docker locally, and found it will not restart a manually stopped container
### Steps to reproduce the issue
1. use docker-compose.yaml
```yaml
version: "3"
networks:
default:
external: false
ipam: {}
name: kwok-kwok
services:
etcd:
command:
- --name=node0
- --initial-advertise-peer-urls=http://0.0.0.0:2380
- --listen-peer-urls=http://0.0.0.0:2380
- --advertise-client-urls=http://0.0.0.0:2379
- --listen-client-urls=http://0.0.0.0:2379
- --initial-cluster=node0=http://0.0.0.0:2380
- --auto-compaction-retention=1
- --quota-backend-bytes=8589934592
- --data-dir=/etcd-data
container_name: kwok-kwok-etcd
entrypoint:
- etcd
image: registry.k8s.io/etcd:3.5.6-0
restart: always
```
2. run `nerdctl compose up -d`
3. run `nerdctl ps` to make sure containers running
4. run `nerdctl compose stop` to stop containers
5. run `nerdctl ps` repeatedly to check containers reappeared
### Describe the results you received and expected
nerdctl compose restart the containers but docker compose not restart the containers
### What version of nerdctl are you using?
v1.2.0
### Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
### Host information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.