Skip to content
⚠️ This wiki is intended and relevant only for DTU Compute - Department of Applied Mathematics and Computer Science

Autograding Image

Important

If you want to create a new container for the autograder in your course, you need to write a Dockerfile and send it to the DTU Compute IT department, where it will be installed.

It might be a good idea to install Autolab and Docker on your own computer, which makes it possible to test your Dockerfiles before they are installed on the DTU server. A tutorial for this installation can be found here.

Note

  1. Ignore the TLS/SSL configuration if you only test on your local machine.
  2. If running Autolab via http://localhost does not grade your submissions, you can add 127.0.0.1 autolab to the system configuration file /etc/hosts in MacOS or \Windows\System32\drivers\etc>type hosts on Windows and access autolab via http://autolab in your browser. Remember to remove it again when it is not needed anymore.

The default Docker container autograding_image, which is provided by Autolab, does not have any special software installed. It looks like:

# Autolab - autograding docker image

FROM ubuntu:18.04
MAINTAINER Autolab Team <autolab-dev@andrew.cmu.edu>

RUN apt-get update && apt-get install -y \
  build-essential \
  gcc \
  git \
  make \
  sudo \
  && rm -rf /var/lib/apt/lists/*

# Install autodriver
WORKDIR /home
RUN useradd autolab
RUN useradd autograde
RUN mkdir autolab autograde output
RUN chown autolab:autolab autolab
RUN chown autolab:autolab output
RUN chown autograde:autograde autograde
RUN git clone --depth 1 https://github.com/autolab/Tango.git
WORKDIR Tango/autodriver
RUN make clean && make
RUN cp autodriver /usr/bin/autodriver
RUN chmod +s /usr/bin/autodriver

# Clean up
WORKDIR /home
RUN apt-get remove -y git && apt-get -y autoremove && rm -rf Tango/

# Check installation
RUN ls -l /home
RUN which autodriver

The examples in this tutorial use Python. A possible modification to the Dockerfile above to include installing Python and NumPy could look like:

# Autolab - autograding docker image with Python

FROM ubuntu:22.04
LABEL maintainer="Julien Hirsch &lt;s233493@dtu.dk&gt;" \
      original_author="Autolab Team &lt;autolab-dev@andrew.cmu.edu&gt;" \
      description="Customized Autolab image with added Python libraries"


RUN apt-get update && apt-get install -y \
  build-essential \
  gcc \
  git \
  make \
  sudo \	
  python3 \ # For Python
  python3-numpy	\   # For Python
  && rm -rf /var/lib/apt/lists/*

# Install autodriver
WORKDIR /home
RUN useradd autolab
RUN useradd autograde
RUN mkdir autolab autograde output
RUN chown autolab:autolab autolab
RUN chown autolab:autolab output
RUN chown autograde:autograde autograde
RUN git clone --depth 1 https://github.com/autolab/Tango.git
WORKDIR Tango/autodriver
RUN make clean && make
RUN cp autodriver /usr/bin/autodriver
RUN chmod +s /usr/bin/autodriver

# Clean up
WORKDIR /home
RUN apt-get remove -y git && apt-get -y autoremove && rm -rf Tango/

# Check installation
RUN ls -l /home
RUN which autodriver
RUN python3 --version

Once you have installed Autolab Docker Compose and written your Dockerfile, you can build the new autograding image. To do so, you have to move your Dockerfile into the autolab-docker/Tango/vmms/folder, stop all Docker containers, build the autograding image from your Dockerfile and lastly, run the Docker containers again.

The following is a precise collection of commands to do this task:

cd autolab-docker
# Move your Dockerfile and rename it to Dockerfile
cp ~/newDockerfile Tango/vmms/Dockerfile
docker compose stop
# Build autograding image and specify name e.g. autograding_imagename
docker build -t autograding_imagename Tango/vmms/
# Check if your image is there
docker images
docker compose up -d
mv Tango/vmms/Dockerfile Tango/vmms/autograding_imagename
Last updated on