Skip to content

[Bug]: Container is showing as running even after being killed #1050

@vsarunas

Description

@vsarunas

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

Hi @jglogan !

While testing #1041 using the kill script in #614, I had noticed that state of the container is not updated if it is killed via kill or launchctl bootout.

Start a container:

container run --name alpine-sleep-$(date +%H%M) --detach alpine sleep infinity
container list
ID                 IMAGE                            OS     ARCH   STATE    ADDR             CPUS  MEMORY   STARTED
alpine-sleep-1648  docker.io/library/alpine:latest  linux  arm64  running  192.168.64.2/24  4     1024 MB  2026-01-14T15:48:52Z

Kill:

launchctl list | grep "com.apple.container.*alpine-sleep" | awk '{print $1}' | xargs kill

Container is showing as running:

container list
ID                 IMAGE                            OS     ARCH   STATE    ADDR             CPUS  MEMORY   STARTED
alpine-sleep-1648  docker.io/library/alpine:latest  linux  arm64  running  192.168.64.2/24  4     1024 MB  2026-01-14T15:48:52Z

Failing to be stopped:

2026-01-14T16:52:11+0100 error com.apple.container: [ContainerCommands] failed to stop container alpine-sleep-1648: internalError: "failed to stop container" (cause: "internalError: "failed to stop container alpine-sleep-1648 (cause: "interrupted: "XPC connection error: Connection invalid"")"")
Error: internalError: "stop failed for one or more containers alpine-sleep-1648"

Still showing as running:

 container list
ID                 IMAGE                            OS     ARCH   STATE    ADDR             CPUS  MEMORY   STARTED
alpine-sleep-1648  docker.io/library/alpine:latest  linux  arm64  running  192.168.64.2/24  4     1024 MB  2026-01-14T15:48:52Z

State will be updated only after full system stop:

container system stop
container system start

Current behavior

Container is shown as running; cannot be stopped and continues to be shown as running until container system stop.

Expected behavior

Update container system state if the container exited outside of container.

Environment

- OS: macOS 26.2
- Xcode: 26.2
- Container: container CLI version 0.7.1-49-gdbec1db (build: release, commit: dbec1db)

Relevant log output

N/A

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