All-Hands-AI / OpenHands

🙌 OpenHands: Code Less, Make More
https://all-hands.dev
MIT License
31.37k stars 3.62k forks source link

[Bug]: Docker container restart failed! #1896

Closed K-tang-mkv closed 4 months ago

K-tang-mkv commented 4 months ago

Is there an existing issue for the same bug?

Describe the bug

firstly, I type the command

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

Everything works fine with that! But after I press Ctrl+C to quit and then run docker start container_id, it fails!
Here is the log:

docker logs exciting_kare 
Starting OpenDevin...
Setting up enduser with id 1000
Docker socket group id: 998
systemd-network:x:998:
Group with id 998 already exists
Running as enduser

INFO:     Started server process [34]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)

^C
Session terminated, killing shell...INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [34]
 ...killed.
Starting OpenDevin...
Setting up enduser with id 1000
useradd: user 'enduser' already exists
Failed to create user enduser with id 1000. Moving opendevin user.
useradd: user 'enduser' already exists
Failed to create user enduser with id 1000 for a second time. Exiting.

The log points out that it failed to create the user 'enduser' with id 1000, so it exits immediately. How can I avoid this and start the container correctly?

Current Version

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
crtl+c

### Model and Agent

_No response_

### Reproduction Steps

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

crtl+c

docker start container_id

docker logs container_id



### Logs, Errors, Screenshots, and Additional Context

_No response_
SmartManoj commented 4 months ago

Could you check the main version?

K-tang-mkv commented 4 months ago

Could you check the main version?

I try to use the main version, but the same problem with that.
Reproduce:

docker pull ghcr.io/opendevin/opendevin:main
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:main
ctrl+c
docker ps -a
CONTAINER ID   IMAGE                              COMMAND                  CREATED          STATUS                      PORTS     NAMES
863e43dd7292   ghcr.io/opendevin/opendevin:main   "/app/entrypoint.sh …"   13 minutes ago   Exited (1) 12 minutes ago             xenodochial_ride
6bb46d7a1e72   ghcr.io/opendevin/opendevin:0.5    "/app/entrypoint.sh …"   3 hours ago      Exited (1) 40 minutes ago             exciting_kare
docker start xenodochial_ride

It fails to start!

docker logs xenodochial_ride
Starting OpenDevin...
Setting up enduser with id 1000
Docker socket group id: 998
systemd-network:x:998:
Group with id 998 already exists
Running as enduser
/app/.venv/lib/python3.12/site-packages/llama_index_client/types/metadata_filter.py:20: SyntaxWarning: invalid escape sequence '\*'
  """
There was a problem when trying to write in your cache folder (/home/enduser/.cache/huggingface/hub). You should set the environment variable TRANSFORMERS_CACHE to a writable directory.
INFO:     Started server process [34]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)

^C
Session terminated, killing shell...INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [34]
 ...killed.
Starting OpenDevin...
Setting up enduser with id 1000
useradd: user 'enduser' already exists
Failed to create user enduser with id 1000. Moving opendevin user.
useradd: user 'enduser' already exists
Failed to create user enduser with id 1000 for a second time. Exiting.
SmartManoj commented 4 months ago

Could you able to run it as root?

K-tang-mkv commented 4 months ago
sudo docker start xenodochial_ride

Still fail to start as root.

SmartManoj commented 4 months ago

for the docker run command itself