(self, container_id)
return status
Execute a Docker container using PRoot. This is the main method
        invoked to run the a container with PRoot.
          * argument: container_id or name
          * options:  many via self.opt see the help
Execute a Docker container using PRoot. This is the main method
        invoked to run the a container with PRoot.
          * argument: container_id or name
          * options:  many via self.opt see the help
Execute a Docker container using PRoot . This is the main method invoked to run the a container with PRoot . * argument : container_id or name * options : many via self . opt see the help
def run(self, container_id):
        """Execute a Docker container using PRoot. This is the main method
        invoked to run the a container with PRoot.
          * argument: container_id or name
          * options:  many via self.opt see the help
        """

        # setup execution
        if not self._run_init(container_id):
            return 2

        self.select_proot()

        # seccomp and ptrace behavior change on 4.8.0 onwards
        if self.proot_noseccomp or os.getenv("PROOT_NO_SECCOMP"):
            self.opt["env"].append("PROOT_NO_SECCOMP=1")

        if self.proot_newseccomp or os.getenv("PROOT_NEW_SECCOMP"):
            self.opt["env"].append("PROOT_NEW_SECCOMP=1")

        if not HostInfo().oskernel_isgreater([3, 0, 0]):
            self._kernel = "6.0.0"

        if self.opt["kernel"]:
            self._kernel = self.opt["kernel"]

        # set environment variables
        self._run_env_set()

        if Msg.level >= Msg.DBG:
            proot_verbose = ["-v", "9", ]
        else:
            proot_verbose = []

        if (Config.conf['proot_killonexit'] and
                self._has_option("--kill-on-exit")):
            proot_kill_on_exit = ["--kill-on-exit", ]
        else:
            proot_kill_on_exit = []

        # build the actual command
        cmd_l = self._set_cpu_affinity()
        cmd_l.append(self.executable)
        cmd_l.extend(proot_verbose)
        cmd_l.extend(proot_kill_on_exit)
        cmd_l.extend(self._get_volume_bindings())
        cmd_l.extend(self._set_uid_map())
        cmd_l.extend(["-k", self._kernel, ])
        cmd_l.extend(self._get_network_map())
        cmd_l.extend(["-r", self.container_root, ])

        if self.opt["cwd"]:  # set current working directory
            cmd_l.extend(["-w", self.opt["cwd"], ])
        cmd_l.extend(self.opt["cmd"])
        Msg().out("CMD =", cmd_l, l=Msg.VER)

        # cleanup the environment
        self._run_env_cleanup_dict()

        # execute
        self._run_banner(self.opt["cmd"][0])
        status = subprocess.call(cmd_l, shell=False, close_fds=True,
                                 env=os.environ.update(self.opt["env"].dict()))
        return status
def run ( self , container_id ) : # setup execution if not self . _run_init ( container_id ) : return 2 self . select_proot ( ) # seccomp and ptrace behavior change on 4.8.0 onwards if self . proot_noseccomp or os . getenv ( "PROOT_NO_SECCOMP" ) : self . opt [ "env" ] . append ( "PROOT_NO_SECCOMP=1" ) if self . proot_newseccomp or os . getenv ( "PROOT_NEW_SECCOMP" ) : self . opt [ "env" ] . append ( "PROOT_NEW_SECCOMP=1" ) if not HostInfo ( ) . oskernel_isgreater ( [ 3 , 0 , 0 ] ) : self . _kernel = "6.0.0" if self . opt [ "kernel" ] : self . _kernel = self . opt [ "kernel" ] # set environment variables self . _run_env_set ( ) if Msg . level >= Msg . DBG : proot_verbose = [ "-v" , "9" , ] else : proot_verbose = [ ] if ( Config . conf [ 'proot_killonexit' ] and self . _has_option ( "--kill-on-exit" ) ) : proot_kill_on_exit = [ "--kill-on-exit" , ] else : proot_kill_on_exit = [ ] # build the actual command cmd_l = self . _set_cpu_affinity ( ) cmd_l . append ( self . executable ) cmd_l . extend ( proot_verbose ) cmd_l . extend ( proot_kill_on_exit ) cmd_l . extend ( self . _get_volume_bindings ( ) ) cmd_l . extend ( self . _set_uid_map ( ) ) cmd_l . extend ( [ "-k" , self . _kernel , ] ) cmd_l . extend ( self . _get_network_map ( ) ) cmd_l . extend ( [ "-r" , self . container_root , ] ) if self . opt [ "cwd" ] : # set current working directory cmd_l . extend ( [ "-w" , self . opt [ "cwd" ] , ] ) cmd_l . extend ( self . opt [ "cmd" ] ) Msg ( ) . out ( "CMD =" , cmd_l , l = Msg . VER ) # cleanup the environment self . _run_env_cleanup_dict ( ) # execute self . _run_banner ( self . opt [ "cmd" ] [ 0 ] ) status = subprocess . call ( cmd_l , shell = False , close_fds = True , env = os . environ . update ( self . opt [ "env" ] . dict ( ) ) ) return status