Skip to content

[Bug]: Orphaned processes are never reaped (no --init support) #1225

@Ninja3047

Description

@Ninja3047

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

container run --name reapro -d alpine:latest sleep 3600

# Create 5 orphans: parent forks child, parent exits, child sleeps 1s then exits
container exec reapro sh -c '
for i in 1 2 3 4 5; do
  sh -c "sh -c \"sleep 1\" &" &
  wait
done'

sleep 3

# All 5 are now permanent zombies
container exec reapro sh -c '
for p in /proc/[0-9]*/status; do
  grep -q "^State:.*Z" "$p" 2>/dev/null && echo "zombie: $(echo $p | cut -d/ -f3)"
done'

container rm -f reapro

Current behavior

All 5 orphaned processes become permanent zombies parented to PID 1. They are never reaped and accumulate over the container's lifetime.

zombie: 8
zombie: 10
zombie: 12
zombie: 14
zombie: 16

The user's entrypoint runs directly as PID 1 inside the container's PID namespace. It never calls wait(), so orphaned children that exit become permanent zombies.

Expected behavior

Orphaned processes should be reaped. Docker solves this with --init, which injects tini as PID 1 to reap children. container has no equivalent flag.

Environment

- OS: macOS 26.2 (25C56)
- Xcode: 26.2 (17C52)
- Container: container CLI version 0.9.0 (build: release)

Relevant log output

$ container exec reapro sh -c '
for p in /proc/[0-9]*/status; do
  grep -q "^State:.*Z" "$p" 2>/dev/null && echo "zombie: $(echo $p | cut -d/ -f3)"
done'
zombie: 8
zombie: 10
zombie: 12
zombie: 14
zombie: 16

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions