Repository: Cloud-CV/evalai-cli
Issue: error while docker submission
Root cause: Environment Incompatibility

Hi @RishabhJain2018 

I am facing this error while trying to do a docker based submission. What might be the issue?

```
 pushkalkatara@pushkalkatara  ~/Desktop/cloudcv/evalai-cli   master ?  evalai push mysubmission:latest --phase 1
Traceback (most recent call last):
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/docker/transport/unixconn.py", line 42, in connect
    sock.connect(self.unix_socket)
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/home/pushkalkatara/miniconda3/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/docker/transport/unixconn.py", line 42, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/bin/evalai", line 11, in <module>
    load_entry_point('evalai', 'console_scripts', 'evalai')()
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/submissions.py", line 97, in push
    docker_image = docker_client.images.get(image)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/docker/models/images.py", line 312, in get
    return self.prepare_model(self.client.api.inspect_image(name))
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/docker/api/image.py", line 245, in inspect_image
    self._get(self._url("/images/{0}/json", image)), True
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/docker/api/client.py", line 215, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/requests/sessions.py", line 537, in get
    return self.request('GET', url, **kwargs)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pushkalkatara/Desktop/cloudcv/evalai-cli/evalai/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

```

Hi @pushkalkatara , Is your docker daemon running without `sudo`?

I missed adding docker to `user` group (post linux installation steps). Now it's working, Thanks.

How can I simulate a docker based challenge, currently it says `Error: Challenge phase with slug {num} does not exist.
`

@pushkalkatara 
Did you use Challenge phase from here:
Its on submission page for Docker Based challenge:
<img width="510" alt="Screenshot 2020-03-04 at 10 17 15 AM" src="https://user-images.githubusercontent.com/3920286/75846137-59a22c00-5e01-11ea-8f0b-dc814d6f871d.png">

If you are not getting this screen, please check if challenge is docker based while creation or 
via django admin

How can I simulate a docker based challenge? where can I find a sample challenge to upload and create a new docker based challenge?

Here it is: https://evalai.readthedocs.io/en/latest/host_challenge.html#host-code-upload-based-challenge

@RishabhJain2018 Thanks for pointing me to the link.

Closing the issue. 

> I missed adding docker to `user` group (post linux installation steps). Now it's working, Thanks.
> 
> How can I simulate a docker based challenge, currently it says `Error: Challenge phase with slug {num} does not exist. `

Hello，I get the same error, I want to know how to add docker to 'user' group?

Here are the steps: https://docs.docker.com/install/linux/linux-postinstall/

> Here are the steps: https://docs.docker.com/install/linux/linux-postinstall/

Thanks a lot. I have solved the problem.