def create_container(self, environment, network_grading, mem_limit, task_path, sockets_path,
                         course_common_path, course_common_student_path, ports=None):
        """
        Creates a container.
        :param environment: env to start (name/id of a docker image)
        :param network_grading: boolean to indicate if the network should be enabled in the container or not
        :param mem_limit: in Mo
        :param task_path: path to the task directory that will be mounted in the container
        :param sockets_path: path to the socket directory that will be mounted in the container
        :param ports: dictionary in the form {docker_port: external_port}
        :return: the container id
        """
        task_path = os.path.abspath(task_path)
        sockets_path = os.path.abspath(sockets_path)
        course_common_path = os.path.abspath(course_common_path)
        course_common_student_path = os.path.abspath(course_common_student_path)
        if ports is None:
            ports = {}

        response = self._docker.containers.create(
            environment,
            stdin_open=True,
            mem_limit=str(mem_limit) + "M",
            memswap_limit=str(mem_limit) + "M",
            mem_swappiness=0,
            oom_kill_disable=True,
            network_mode=("bridge" if (network_grading or len(ports) > 0) else 'none'),
            ports=ports,
            volumes={
                task_path: {'bind': '/task'},
                sockets_path: {'bind': '/sockets'},
                course_common_path: {'bind': '/course/common', 'mode': 'ro'},
                course_common_student_path: {'bind': '/course/common/student', 'mode': 'ro'}
            }
        )
        return response.id
Creates a container.
        :param environment: env to start (name/id of a docker image)
        :param network_grading: boolean to indicate if the network should be enabled in the container or not
        :param mem_limit: in Mo
        :param task_path: path to the task directory that will be mounted in the container
        :param sockets_path: path to the socket directory that will be mounted in the container
        :param ports: dictionary in the form {docker_port: external_port}
        :return: the container id