coursera/coursera_autograder

Autograder tool fails with Alpine-based image

kilbd opened this issue · 2 comments

kilbd commented

The autograder tool works fine when using one of the standard, Debian-based Python images for my custom grader (e.g., python:3.8), but fails when I try to use an image based on Alpine Linux (e.g., python:3.8-alpine).

I'm running Docker Desktop 3.1.0 for macOS Big Sur. Here is the error I see:

ERROR:root:Problem when running command. Sorry!
Traceback (most recent call last):
  File "/Users/xxxx/Documents/projects/coursera_autograder/venv/lib/python3.8/site-packages/docker_py-1.10.4-py3.8.egg/docker/client.py", line 170, in _raise_for_status
    response.raise_for_status()
  File "/Users/xxxx/Documents/projects/coursera_autograder/venv/lib/python3.8/site-packages/requests-2.9.2-py3.8.egg/requests/models.py", line 844, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localunixsocket/v1.41/containers/2f442590f49957a335b0200e278dccecb3e836908d486aad5ba07a80e22e3132/archive?path=%2Fshared%2Ffeedback.json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/xxxx/Documents/projects/coursera_autograder/coursera_autograder/main.py", line 101, in main
    return args.func(args)
  File "/Users/xxxx/Documents/projects/coursera_autograder/coursera_autograder/commands/grade.py", line 181, in command_grade_local
    run_container(d, container, args)
  File "/Users/xxxx/Documents/projects/coursera_autograder/coursera_autograder/commands/grade.py", line 53, in run_container
    get_feedback(docker, container, "feedback.json", args.dst_dir)
  File "/Users/xxxx/Documents/projects/coursera_autograder/coursera_autograder/commands/grade.py", line 41, in get_feedback
    raw_stream,status = docker.get_archive(container, "/shared/" + file_name)
  File "/Users/xxxx/Documents/projects/coursera_autograder/venv/lib/python3.8/site-packages/docker_py-1.10.4-py3.8.egg/docker/utils/decorators.py", line 21, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/Users/xxxx/Documents/projects/coursera_autograder/venv/lib/python3.8/site-packages/docker_py-1.10.4-py3.8.egg/docker/utils/decorators.py", line 35, in wrapper
    return f(self, *args, **kwargs)
  File "/Users/xxxx/Documents/projects/coursera_autograder/venv/lib/python3.8/site-packages/docker_py-1.10.4-py3.8.egg/docker/api/container.py", line 187, in get_archive
    self._raise_for_status(res)
  File "/Users/xxxx/Documents/projects/coursera_autograder/venv/lib/python3.8/site-packages/docker_py-1.10.4-py3.8.egg/docker/client.py", line 173, in _raise_for_status
    raise errors.NotFound(e, response, explanation=explanation)
docker.errors.NotFound: 404 Client Error: Not Found ("b'{"message":"Could not find the file /shared/feedback.json in container 2f442590f49957a335b0200e278dccecb3e836908d486aad5ba07a80e22e3132"}'")
Task Terminated with exit code 1
kilbd commented

Now I'm not seeing a difference between Linux flavors. The Debian-based image is now returning the same error as above. I'm wondering if this is related to #16 or if this is unique to Docker Desktop for macOS (e.g., different location for Docker socket).

kilbd commented

Ha, the problem appears to have been in my script. I didn't update the script shebang when moving to Alpine to avoid the Debian CVE. I do wish that the output of the autograder tool would have helped me troubleshoot the issue better.

Closing this issue.