glotcode / docker-run

Api for running untrusted code in containers
MIT License
108 stars 25 forks source link

Failed to create container: Failed while sending request: Failed deserialize response body: invalid type: null, expected a sequence at line 1 column 88 #4

Closed yyexplore closed 2 years ago

yyexplore commented 3 years ago

Hello

When I try to run snippet , invalid type: null got from docker-run, I checked the request body, no error found

Please see the request and response

Request

{
   "image": "glot/python:latest",
   "payload": {
      "language": "python",
      "files": [
         {
            "name": "main.py",
            "content": "print(42)"
         }
      ]
   }
}

Response: 400 Bad Request

{
    "error": "docker.container.create",
    "message": "Failed to create container: Failed while sending request: Failed deserialize response body: invalid type: null, expected a sequence at line 1 column 88"
}
chengyu2333 commented 2 years ago

I have the same problem.

prasmussen commented 2 years ago

Are you using the public api or do you run your own docker-run?

chengyu2333 commented 2 years ago

I used"docker.io/glot/docker-run" docker image.

The run cmd such as: docker run --detach --restart=always --publish 8088:8088 --volume /var/run/docker.sock:/var/run/docker.sock --env "API_ACCESS_TOKEN=goodat" --env "DOCKER_CONTAINER_MEMORY=128000000" --env="RUN_MAX_EXECUTION_TIME=30" --env="RUN_MAX_OUTPUT_SIZE=1000000" --env="SERVER_WORKER_THREADS=500" --name docker-run glot/docker-run:latest

chengyu2333 commented 2 years ago

The system version is : CentOS 7.9 Linux kernel is : Linux iZ8vb4jx3hms7zl240bdveZ 3.10.0-1160.53.1.el7.x86_64 #1 SMP Fri Jan 14 13:59:45 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

prasmussen commented 2 years ago

It seems like the docker-run doesn't work properly inside docker in all situations. I haven't been able to track down the issues, but it's probably related to the docker.sock volume

On glot.io I run docker-run without docker, as a systemd service (see example in docs)

chengyu2333 commented 2 years ago

I try to reinstall docker with "yum install docker-ce" instead of "yum install docker".It works.

Before installed: [root@iZ8vb4jx3hms7zl240bdveZ ~]# yum list installed | grep docker docker.x86_64 2:1.13.1-209.git7d71120.el7.centos @extras
docker-client.x86_64 2:1.13.1-209.git7d71120.el7.centos @extras
docker-common.x86_64 2:1.13.1-209.git7d71120.el7.centos @extras

After: [root@iZ8vb4jx3hms7zl240bdveZ ~]# yum list installed | grep docker containerd.io.x86_64 1.5.11-3.1.el7 @docker-ce-stable docker-ce.x86_64 3:20.10.14-3.el7 @docker-ce-stable docker-ce-cli.x86_64 1:20.10.14-3.el7 @docker-ce-stable docker-ce-rootless-extras.x86_64 20.10.14-3.el7 @docker-ce-stable docker-scan-plugin.x86_64 0.17.0-3.el7 @docker-ce-stable

prasmussen commented 2 years ago

That's interesting. So anyone that has this probably should check if they are running the CE edition of docker. Thanks for figuring this out 👍