duckietown / duckietown-shell

Other
3 stars 6 forks source link

Local evaluation with dts challenges evaluate doesn't work. #31

Closed bhairavmehta95 closed 6 years ago

bhairavmehta95 commented 6 years ago

Error Message:

DEBUG:dts:checking docker environment
INFO:dts:The server URL is: https://challenges.duckietown.org/v3
INFO:dts:Updating container duckietown/dt-challenges-evaluator:v3
INFO:dts:Starting container local-evaluator with duckietown/dt-challenges-evaluator:v3
INFO:dts:Container command: dt-challenges-evaluate-local --output output
INFO:dts:status: running
INFO:dts:duckietown-shell 3.0.14
INFO:duckietown-challenges:duckietown-challenges 3.0.27
ERRO[0000] failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial unix /var/run/docker.sock: connect: permission denied 
context canceled

This seems like an issue with my Docker daemon, but I don't think that is the case.

Regular docker (i.e docker run...), docker-compose (i.e docker-compose up) work just fine, as well as the dts challenges submit command.

I have updated to the latest dts with dts update.

Won't have much time today to look into this, but I will update here if I find the reason.

AndreaCensi commented 6 years ago

What is the value of DOCKER_HOST?

bhairavmehta95 commented 6 years ago

Nothing - is it supposed to have a value?

AndreaCensi commented 6 years ago

No, it isn't.

It sounds like the communication with the docker host is not working.

Are you on linux, mac? any special configuration? Is the docker daemon running?

AndreaCensi commented 6 years ago

Do you have /var/run/docker.sock as the docker endpoint?

bhairavmehta95 commented 6 years ago

Linux - No special configuration. Docker endpoint seems to be configured okay, since I can run every other docker command and things like portainer.

If we can confirm that its just a issue on my local machine, then we can leave it (I will debug it myself). I just wanted to raise the issue to make sure there were no breaking changes in one of the updates.

AndreaCensi commented 6 years ago

Is this the same as the other?

bhairavmehta95 commented 6 years ago

No they are different.

bhairavmehta95 commented 6 years ago

@AndreaCensi did some debugging, but I really don't what the issue is? I don't think its a purely isolated issue because we saw another instance. It seems that

dt-challenges-evaluate-local works? As you said, I think we should just update the docs to use this method.

AndreaCensi commented 6 years ago

The problem is that the native Python code will be brittle because of environment variations.

By the way the lines that launch the image are here: https://github.com/duckietown/duckietown-shell-commands/blob/e2e100e4a652b8fd4a69813205eba88c43422694/challenges/evaluate/command.py#L164-L174

bhairavmehta95 commented 6 years ago

Just a hypothesis, but I think the issue might be with the user argument. Older, working versions of your code didn't have that, and according to here:

https://docker-py.readthedocs.io/en/stable/containers.html

If using the UID, it should be an int, and if using a username, it should be a string. What that line is doing is casting the UID to a string, and that might (somewhere inside of the docker-py code) treat it like a username, for which the username won't be valid.

AndreaCensi commented 6 years ago

@bhairavmehta95 I think one problem was that we didn't pass the "groups" parameter. A user can use the socket if it is in the "docker" group.

Can you try again?

AndreaCensi commented 6 years ago

see here: https://github.com/duckietown/duckietown-shell-commands/blob/a9d76d7617a109865b67151881d0aad9e03e57f6/challenges/evaluate/command.py#L165-L179