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

        Config.conf['sysdirs_list'] = (
            "/etc/resolv.conf", "/etc/host.conf",
            # "/etc/passwd", "/etc/group",
        )

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

        self._run_invalid_options()

        self._container_specfile = "config.json"
        if self.container_dir:
            if self.localrepo.iswriteable_container(container_id):
                self._container_specdir = self.container_dir
            else:
                self._container_specdir = FileUtil("SPECDIR").mktmpdir()
                FileUtil(self._container_specdir).register_prefix()
            self._container_specfile = \
                    self._container_specdir + '/' + self._container_specfile

        self._filebind = FileBind(self.localrepo, container_id)
        self._filebind.setup()
        self.select_runc()

        # create new OCI spec file
        if not self._load_spec(new=True):
            return 4

        self._uid_check()

        # if not --hostenv clean the environment
        self._run_env_cleanup_list()

        # set environment variables
        self._run_env_set()
        self._set_spec()
        if (Config.conf['runc_nomqueue'] or
                (Config.conf['runc_nomqueue'] is None and not
                 HostInfo().oskernel_isgreater([4, 8, 0]))):
            self._del_mount_spec("mqueue", "/dev/mqueue")

        self._del_mount_spec("cgroup", "/sys/fs/cgroup")
        self._del_namespace_spec("network")
        self._set_id_mappings()
        self._add_volume_bindings()
        self._add_devices()
        self._add_capabilities_spec()
        self._mod_mount_spec("shm", "/dev/shm", {"options": ["size=2g"]})
        self._proot_overlay()
        self._save_spec()
        if Msg.level >= Msg.DBG:
            runc_debug = ["--debug", ]
            Msg().out(json.dumps(self._container_specjson,
                                 indent=4, sort_keys=True))
        else:
            runc_debug = []

       # build the actual command
        self.execution_id = Unique().uuid(self.container_id)
        cmd_l = self._set_cpu_affinity()
        cmd_l.append(self.executable)
        cmd_l.extend(runc_debug)
        cmd_l.extend(["--root", self._container_specdir, "run"])
        cmd_l.extend(["--bundle", self._container_specdir, self.execution_id])
        Msg().err("CMD =", cmd_l, l=Msg.VER)
        self._run_banner(self.opt["cmd"][0], '%')
        if sys.stdout.isatty():
            return self.run_pty(cmd_l)

        return self.run_nopty(cmd_l)
def run ( self , container_id ) : Config . conf [ 'sysdirs_list' ] = ( "/etc/resolv.conf" , "/etc/host.conf" , # "/etc/passwd", "/etc/group", ) # setup execution if not self . _run_init ( container_id ) : return 2 self . _run_invalid_options ( ) self . _container_specfile = "config.json" if self . container_dir : if self . localrepo . iswriteable_container ( container_id ) : self . _container_specdir = self . container_dir else : self . _container_specdir = FileUtil ( "SPECDIR" ) . mktmpdir ( ) FileUtil ( self . _container_specdir ) . register_prefix ( ) self . _container_specfile = self . _container_specdir + '/' + self . _container_specfile self . _filebind = FileBind ( self . localrepo , container_id ) self . _filebind . setup ( ) self . select_runc ( ) # create new OCI spec file if not self . _load_spec ( new = True ) : return 4 self . _uid_check ( ) # if not --hostenv clean the environment self . _run_env_cleanup_list ( ) # set environment variables self . _run_env_set ( ) self . _set_spec ( ) if ( Config . conf [ 'runc_nomqueue' ] or ( Config . conf [ 'runc_nomqueue' ] is None and not HostInfo ( ) . oskernel_isgreater ( [ 4 , 8 , 0 ] ) ) ) : self . _del_mount_spec ( "mqueue" , "/dev/mqueue" ) self . _del_mount_spec ( "cgroup" , "/sys/fs/cgroup" ) self . _del_namespace_spec ( "network" ) self . _set_id_mappings ( ) self . _add_volume_bindings ( ) self . _add_devices ( ) self . _add_capabilities_spec ( ) self . _mod_mount_spec ( "shm" , "/dev/shm" , { "options" : [ "size=2g" ] } ) self . _proot_overlay ( ) self . _save_spec ( ) if Msg . level >= Msg . DBG : runc_debug = [ "--debug" , ] Msg ( ) . out ( json . dumps ( self . _container_specjson , indent = 4 , sort_keys = True ) ) else : runc_debug = [ ] # build the actual command self . execution_id = Unique ( ) . uuid ( self . container_id ) cmd_l = self . _set_cpu_affinity ( ) cmd_l . append ( self . executable ) cmd_l . extend ( runc_debug ) cmd_l . extend ( [ "--root" , self . _container_specdir , "run" ] ) cmd_l . extend ( [ "--bundle" , self . _container_specdir , self . execution_id ] ) Msg ( ) . err ( "CMD =" , cmd_l , l = Msg . VER ) self . _run_banner ( self . opt [ "cmd" ] [ 0 ] , '%' ) if sys . stdout . isatty ( ) : return self . run_pty ( cmd_l ) return self . run_nopty ( cmd_l )