From b81063035ed83677fed95f3b9895412482d231df Mon Sep 17 00:00:00 2001 From: Rightpeter Date: Sat, 23 Feb 2019 19:21:47 -0600 Subject: [PATCH] Imitate the real docker environment on Coursera --- courseraprogramming/commands/grade.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/courseraprogramming/commands/grade.py b/courseraprogramming/commands/grade.py index 420475a..31f6695 100644 --- a/courseraprogramming/commands/grade.py +++ b/courseraprogramming/commands/grade.py @@ -138,11 +138,17 @@ def command_grade_local(args): try: volume_str = common.mk_submission_volume_str(args.dir) logging.debug("Volume string: %s", volume_str) + + extra_hosts = { + 'somehost': "192.168.1.2", + } + host_config = d.create_host_config( binds=[volume_str, ], network_mode='none', mem_limit=memory_limit, memswap_limit=memory_limit, + extra_hosts=extra_hosts, ) user = '%s' % 1000 @@ -161,6 +167,7 @@ def command_grade_local(args): entrypoint=cmd, user=user, host_config=host_config, + hostname='somehost', ) else: container = d.create_container(