OpenHands
OpenHands copied to clipboard
[Bug]: Main OpenDevin container does not clean up sandbox containers on shutdown
Is there an existing issue for the same bug?
- [X] I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
- [X] I have checked the existing issues.
Describe the bug
When stopping the main OpenDevin container with CTRL+C, the sandbox container remains running. This leads to the accumulation of numerous running containers, which clutters the Docker environment. The sandbox containers should be automatically stopped and removed when the main container is stopped.
There is a related issue here: https://github.com/OpenDevin/OpenDevin/issues/1462 but it was closed.
Current Version
0.5 (from Docker image ghcr.io/opendevin/opendevin:0.5)
Installation and Configuration
docker run \
-it \
--pull=always \
-e LLM_API_KEY \
-e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-v $WORKSPACE_BASE:/opt/workspace_base \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 3000:3000 \
--add-host host.docker.internal:host-gateway \
ghcr.io/opendevin/opendevin:0.5
Model and Agent
- Model: gpt-4o
- Agent: CodeActAgent
Reproduction Steps
- Launch the OpenDevin container with the docker run command from the README (as shown above)
- Ask OpenDevin to do something which will invoke the sandbox environment (e.g. "Run the hostname command")
- Stop the main container with CTRL+C
- Check for the remaining sandbox container with
docker ps
If you repeat the steps above several times, you will see that you have multiple sandbox containers still running.
Logs, Errors, Screenshots, and Additional Context
Environment details:
- Docker version: 4.29.0
- OS: macOS 14.4.1
Example docker ps output:
% docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a63e75de014e ghcr.io/opendevin/sandbox:main "/usr/sbin/sshd -D -…" 14 minutes ago Up 14 minutes 0.0.0.0:36389->36389/tcp opendevin-sandbox-2569336a-283a-4aae-8624-1657ea13636bb5ff7e65-7687-4cb0-a1ea-986a2775c27f
909fc44003fd ghcr.io/opendevin/sandbox:main "/usr/sbin/sshd -D -…" 15 minutes ago Up 15 minutes 0.0.0.0:60859->60859/tcp opendevin-sandbox-2569336a-283a-4aae-8624-1657ea13636b435c7f33-9fed-4c06-8621-b98b3d175b57
095ab0333d73 ghcr.io/opendevin/sandbox:main "/usr/sbin/sshd -D -…" 15 minutes ago Up 15 minutes 0.0.0.0:36111->36111/tcp opendevin-sandbox-2569336a-283a-4aae-8624-1657ea13636bd675c5a2-7c8e-4e71-acad-0bea68136083
I can confirm.
got the same problem that sandbox container still running after ctrl+c for quitting app
I try the latest image, seems no problem. I guess already fixed. Close it.
docker run \
-it \
--pull=always \
-e LLM_API_KEY \
-e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-v $WORKSPACE_BASE:/opt/workspace_base \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 3000:3000 \
--add-host host.docker.internal:host-gateway \
ghcr.io/opendevin/opendevin:latest
If still exist in latest image, free feel to reopen it.