Repository navigation
Description
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
Please watch the video:
error-on-start-after-stopping-container.mov
Current behavior
- Start a container
container start redis- Stop the container
container stop redis- Start same container within a second
container start redisHere you will get Error: internalError: "failed to bootstrap container" (cause: "internalError: "failed to bootstrap container redis (cause: "invalidState: "container expected to be in created state, got: shuttingDown"")"")
And it automatically removes the container from the system.
Expected behavior
- Start a container
container start redis- Stop the container
container stop redis- Start same container within a second
container start rediswith no errors or safe fallback [Last version I used was 0.4.1, and it works fine].
Environment
- OS: macOS 26.0.1 (25A362)
- Xcode: Version 26.0 (17A5276g)
- Container: 0.6.0Relevant log output
Error Output:
Error: internalError: "failed to bootstrap container" (cause: "internalError: "failed to bootstrap container redis (cause: "invalidState: "container expected to be in created state, got: shuttingDown"")"")
Container System Logs (container system logs):
container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] starting start [uuid=redis]
2025-11-03 15:07:16.912561+0530 0x3495b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] configuring XPC server [uuid=redis]
2025-11-03 15:07:16.912799+0530 0x3495b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] starting XPC server [uuid=redis]
2025-11-03 15:07:16.913228+0530 0x3496a Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `createEndpoint` xpc handler [uuid=redis]
2025-11-03 15:07:16.913521+0530 0x3496a Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `bootstrap` xpc handler [uuid=redis]
2025-11-03 15:07:16.917368+0530 0x3496c Info 0x0 7903 0 container-network-vmnet: [com.apple.container:NetworkVmnetHelper] allocated attachment [address=192.168.64.19/24] [gateway=192.168.64.1] [hostname=redis] [id=default]
2025-11-03 15:07:16.917587+0530 0x3495b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] creating NATNetworkInterface with network reference [uuid=redis]
2025-11-03 15:07:17.358438+0530 0x3495b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `startProcess` xpc handler [uuid=redis]
2025-11-03 15:07:17.466438+0530 0x3469e Info 0x0 7894 0 container-apiserver: [com.apple.container:APIServer] registering container redis with exit monitor
2025-11-03 15:07:17.466587+0530 0x3495b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `state` xpc handler [uuid=redis]
2025-11-03 15:07:17.467322+0530 0x3496b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `wait` xpc handler [uuid=redis]
2025-11-03 15:07:19.197011+0530 0x3496a Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `stop` xpc handler [uuid=redis]
2025-11-03 15:07:19.311404+0530 0x3496a Error 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] process deletion [id=redis] [uuid=redis] [error=internal error (13): unknown error processing request]
2025-11-03 15:07:19.318388+0530 0x3495b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] init process exited with: ExitStatus(exitCode: 0, exitedAt: 2025-11-03 09:37:19 +0000) [uuid=redis]
2025-11-03 15:07:19.392325+0530 0x349e8 Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] closing forwarders [uuid=redis]
2025-11-03 15:07:19.392326+0530 0x349e8 Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] closed forwarders [uuid=redis]
2025-11-03 15:07:19.392639+0530 0x34750 Info 0x0 7903 0 container-network-vmnet: [com.apple.container:NetworkVmnetHelper] released attachments [id=default] [hostname=redis]
2025-11-03 15:07:19.397007+0530 0x345fa Info 0x0 7894 0 container-apiserver: [com.apple.container:APIServer] Shutting down sandbox service for redis
2025-11-03 15:07:19.397250+0530 0x3496b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `shutdown` xpc handler [uuid=redis]
2025-11-03 15:07:20.820642+0530 0x349e8 Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `createEndpoint` xpc handler [uuid=redis]
2025-11-03 15:07:20.821021+0530 0x3496b Info 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `bootstrap` xpc handler [uuid=redis]
2025-11-03 15:07:20.821794+0530 0x3496b Error 0x0 20755 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] handler for com.apple.container.sandbox/bootstrap threw error invalidState: "container expected to be in created state, got: shuttingDown" [uuid=redis]
2025-11-03 15:07:20.831084+0530 0x3469e Error 0x0 7894 0 container-apiserver: [com.apple.container:APIServer] WaitHandler for redis threw error internalError: "failed to wait for process redis in container redis" (cause: "interrupted: "XPC connection error: Connection interrupted"")
2025-11-03 15:07:20.903142+0530 0x346a0 Error 0x0 7894 0 container-apiserver: [com.apple.container:APIServer] handler for containerBootstrap threw error internalError: "failed to bootstrap container redis" (cause: "invalidState: "container expected to be in created state, got: shuttingDown"")
2025-11-03 15:07:20.903147+0530 0x3469f Info 0x0 7894 0 container-apiserver: [com.apple.container:APIServer] Handling container redis exit. Code ExitStatus(exitCode: -1, exitedAt: 2025-11-03 09:37:20 +0000)
2025-11-03 15:07:20.903712+0530 0x3469e Error 0x0 7894 0 container-apiserver: [com.apple.container:APIServer] handler for containerStop threw error notFound: "container with ID redis not found"Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-][Bug]: Container auto deletes when we stop a container and start the same container in within few milliseconds.[/-][+][Bug]: Container auto deletes when we stop a container and start the same container within few milliseconds.[/+]Ronitsabhaya75 commentedon Nov 3, 2025
Hi @theetherGit, I've been looking at video and found this
this is what i think happening here:
container stop redis→ state changes to.shuttingDowncontainer start redisquickly (within that 5-second window).shuttingDowni think way we can improve here is
.shuttingDownstate and wait for it to completelet me know if this make sense
dcantah commentedon Nov 3, 2025
Can fix, thanks
theetherGit commentedon Nov 4, 2025
@Ronitsabhaya75
I didn't knew about 5 second delay and
shuttingDownstate is the reason for the auto removal of container.@dcantah & @realrajaryan Thanks
fix(container): prevent auto-delete on rapid stop+start (apple#833)
fix(container): prevent auto-delete on rapid stop+start (apple#833)
fix(container): prevent auto-delete on rapid stop+start (apple#833)
fix(container): prevent auto-delete on rapid stop+start (apple#833)
Fix container auto-delete on rapid stop/start (apple#841)
Fix container auto-delete on rapid stop/start (apple#841)
Squashed commit of the following:
Squashed commit of the following:
Squashed commit of the following:
Fix container auto-delete on rapid stop/start (apple#841)