Example #1
0
 def _setup_docker_image(self):
   memory_limit_str = self.config.get('memory_limit', '')
   s = 'docker run --cpus=1 --cpuset-cpus="{core}" --ipc="host" ' \
       '-u {user_id}:{group_id} ' \
       '--cap-add=SYS_PTRACE --security-opt seccomp=unconfined {memory_limit_str} ' \
       '--name={docker_name} -td {docker_build}  > /dev/null 2>&1'.format(
                                       core=CoreManager().core[self.config["core"]],
                                       user_id=os.getuid(),
                                       group_id=os.getgid(), 
                                       docker_build=self.docker_build, 
                                       memory_limit_str=memory_limit_str, 
                                       docker_name=self.docker_name)
   print(s)
   os.system(s)
Example #2
0
 def _update(self):
   os.system('docker update --cpuset-cpus="{core}" {docker_name} > /dev/null 2>&1'.format(core=CoreManager().core[self.config["core"]], docker_name=self.docker_name))
   os.system('docker update --cpus="{share}" {docker_name} > /dev/null 2>&1'.format(share="%.02f" % self.config["cpu_share"], docker_name=self.docker_name))