-
Notifications
You must be signed in to change notification settings - Fork 7
How to create a new container
In this page you will see How to create a new container for assess a submission with another language or dependencies using Docker.
Here you will find help about how to create containers with new languages, programs, and dependencies for INGInious. In order to make possible to extend available tools for assess the student's work.
A container can be seen as a 'Operating System' with customized configurations. Nowadays, you can find the repository that stores the containers in the following link: INGInious containers.
When you open the link given before, you will see the next files:
Into the batch folder you will find the code related to the containers that are in charge of bock processing . This containers are used for processing many submissions at the same time, and it is useful for use a plagiarism detector in the submissions.
Into the grading folder you will find the code related to the grading containers, containers that grade the submissions made by the students. For the purpose of this page, we will be focused just on this folder.
The following diagram shows the hierarchy associated to the containers. As you can observe, the containers that are used in the platform are the ones that are at last level (Java8, C++, Python3, ... ) .
For the purpose to illustrate how to create a new container , first of all we will observe how have been created the already created ones, so that when you create one by your own it will be easier.
FROM clause specifies the immediate ancestor from the new container will inherit, for this case, this will be the base container.
LABEL clause specifies the new container's name (This name will be the same that is shown in the platform when the task is created).
RUN clause specifies a CentOS command, in this case, CentOS package manager is a program called yum. The above image shows how was used the package manager for install a new dependence: C++ compiler. (To see the whole code, please click the next link: Dockerfile C++)
Note: Before continue with the guide, please see other containers into the repository, thus you will familiarize with the platform.
Note 2: If you want to create a new container directly on your computer (Faster but not suggested) jump to the step 2.
- Must be installed git and to have a GitHub account.
- Must be a collaborator in the repository.
- Must be installed Docker. (How to install Docker)
- You have to have access to the server via ssh or ask to the person in charge of the project to compile it for you.
Clone repository:
git clone https://github.com/JuezUN/INGInious-containers.git
Create a new branch, write next commands:
cd INGInious-containers
git checkout -b my-branch
Next image shows the above steps:
Once you are located into the INGInious-containers folder, go into the grading folder (where are located all the containers)
cd grading/
Create your new container folder (replace my-container with the desired name for the container) :
mkdir my-container
In the case that are needed software or files that are not available by package manager 'yum' as in the case of verilog container. In order to add dependencies, just copy that what is needed into the already created folder.
Create a file called Dockerfile and write the next code into it:
FROM ingi/inginious-c-multilang
LABEL org.inginious.grading.name = "my-container"
Replace 'my-container' with the of your container's name (folder's name). Then, write the commands that have to be executed either to copy the files or to install dependencies. As an example, the bellow image shows the Dockerfile for verilog, where a file located into the created folder is copied and it is installed using rpm instead of yum.
Note: You are able to change the parent container (in this case is multilang). That means, that you can grade in multiple languages at the same time that you add new dependencies.
This Dockerfile copies the verilog installer through the ADD clause and installs it through the command in the RUN clause. For more information about supported clauses, please consult the official documentation.
For testing the right work of Dockerfile, it is necessary to have installed Docker.
Go to the INGInious-container folder root and write the next command:
bash build-container.sh my-container
The following image shows how is compiled a container, in this case have been compiled the Verilog container.
Note: If you are working on the server, jump to step 10.
Once changes are tested, write the next commands:
git add .
git commit -m "Adding container my-container"
git push --set-upstream origin my-branch
Go to the repository in GitHub, click on Pull Requests tab and click on New pull request button. Chose JuezUN/INGinious containers as base fork.
In compare select my-branch and click on Create pull request
Will appear a text area where you have to specify the realized changes. Then, request a review to one of the project managers.
Click on merge pull request to finish the process.
In order yo update the committed changes into the server, you have access to it via ssh. Once done it, go into INGInious-containers folder and write:
git pull
This will pull all committed changes in the repository.
This step is the same as step 5, where you test your container, and the unique difference is step 5 is committed on your localhost instead of this will happen on the server.
For the purpose to detect the recently compiled containers you have to restart the service. For that, you have to know the PID of the process that is running INGInious. Write the following:
ps -e | grep inginious
This commando will give as output the PID of INGInious (suppose that is XYZ). So, write:
kill -9 XYZ
To conclude, restart the service, for that write the following command (bear in mind this have to be don into the folder where is installed INGInious, where is located the configuration.yaml file):
inginious-webapp &
This will execute the service again with the installed container and the '&' character will won't block the bash console allowing you to finish the ssh session.
Next images shows what was mentioned above:
If everything was right, now you will be able to see the new container when you are creating a new task (Verilog for this case) .
UNCode - Distributed and maintained by the Universidad Nacional de Colombia, Campus Bogotá.
Visit the UNCode web page.
Visit UNCode.
- Home
- User's Documentation
- Developer's Documentation
- Deploy UNCode
- Others