containerd / containerd/nerdctl
Container logs stop printing after restart with `restart: on-failure` set in compose
- Dominant language
- Go
- Stars
- 10.4k
- Forks
- 826
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 44
Description
### Description
When a container restarts on failure the log is not printed out to console when the compose file is launched using `nerdctl compose up`
Using this compose file
```yaml
version: "3.9"
services:
db:
image: postgres:15
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
restart: on-failure
environment:
- POSTGRES_PASSWORD=alongpassword
```
and a bad SQL init.sql
```sql
CREATE DATABASE IF NOT EXISTS `bad`;
```
### Steps to reproduce the issue
1. Run `nerdctl compose up` with the above files
2. See PostgreSQL fail and INFO[0001] All the containers have exited
3. See that PostgreSQL has restarted with `nerdctl ps` in another console
If we have multiple containers in the compose file, nerdctl will continue to output logs for the other app but will stop showing logs for PostgreSQL in 2.
### Describe the results you received and expected
Not exit and continue to print logs for the restarted container
### What version of nerdctl are you using?
Client:
Version: v1.4.0
OS/Arch: linux/arm64
Git commit: 7e8114a82da342cdbec9a518c5c6a1cce58105e9
buildctl:
Version: v0.11.6
GitCommit: 2951a28cd7085eb18979b1f710678623d94ed578
Server:
containerd:
Version: v1.7.0
GitCommit: 1fbd70374134b891f97ce19c70b6e50c7b9f4e0d
runc:
Version: 1.1.7
GitCommit: 860f061b76bb4fc671f0f9e900f7d80ff93d4eb7
### Are you using a variant of nerdctl? (e.g., Rancher Desktop)
Rancher Desktop for macOS
### Host information
Client:
Namespace: default
Debug Mode: false
Server:
Server Version: v1.7.0
Storage Driver: overlayfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Log: fluentd journald json-file syslog
Storage: native overlayfs
Security Options:
seccomp
Profile: default
Kernel Version: 6.1.30-0-virt
Operating System: Alpine Linux v3.18
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 9.698GiB
Name: lima-rancher-desktop
ID: 27e0c08b-22e6-44f3-9667-e102c2b03384
WARNING: IPv4 forwarding is disabled
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.