(self, imagerepo, tag)
return self.container_id
Create a container from an image in the repository.
        Since images are stored as layers in tar files, this
        step consists in extracting those layers into a ROOT
        directory in the appropriate sequence.
        first argument: imagerepo
        second argument: image tag in that repo
Create a container from an image in the repository.
        Since images are stored as layers in tar files, this
        step consists in extracting those layers into a ROOT
        directory in the appropriate sequence.
        first argument: imagerepo
        second argument: image tag in that repo
Create a container from an image in the repository . Since images are stored as layers in tar files this step consists in extracting those layers into a ROOT directory in the appropriate sequence . first argument : imagerepo second argument : image tag in that repo
def create_fromimage(self, imagerepo, tag):
        """Create a container from an image in the repository.
        Since images are stored as layers in tar files, this
        step consists in extracting those layers into a ROOT
        directory in the appropriate sequence.
        first argument: imagerepo
        second argument: image tag in that repo
        """
        self.imagerepo = imagerepo
        self.tag = tag
        image_dir = self.localrepo.cd_imagerepo(self.imagerepo, self.tag)
        if not image_dir:
            Msg().err("Error: create container: imagerepo is invalid")
            return False

        (container_json, layer_files) = self.localrepo.get_image_attributes()
        if not container_json:
            Msg().err("Error: create container: getting layers or json")
            return False

        if not self.container_id:
            self.container_id = Unique().uuid(os.path.basename(self.imagerepo))

        container_dir = self.localrepo.setup_container(
            self.imagerepo, self.tag, self.container_id)
        if not container_dir:
            Msg().err("Error: create container: setting up container")
            return False

        self.localrepo.save_json(
            container_dir + "/container.json", container_json)
        status = self._untar_layers(layer_files, container_dir + "/ROOT")
        if not status:
            Msg().err("Error: creating container:", self.container_id)
        elif not self._chk_container_root():
            Msg().out("Warning: check container content:", self.container_id,
                      l=Msg.WAR)

        return self.container_id
def create_fromimage ( self , imagerepo , tag ) : self . imagerepo = imagerepo self . tag = tag image_dir = self . localrepo . cd_imagerepo ( self . imagerepo , self . tag ) if not image_dir : Msg ( ) . err ( "Error: create container: imagerepo is invalid" ) return False ( container_json , layer_files ) = self . localrepo . get_image_attributes ( ) if not container_json : Msg ( ) . err ( "Error: create container: getting layers or json" ) return False if not self . container_id : self . container_id = Unique ( ) . uuid ( os . path . basename ( self . imagerepo ) ) container_dir = self . localrepo . setup_container ( self . imagerepo , self . tag , self . container_id ) if not container_dir : Msg ( ) . err ( "Error: create container: setting up container" ) return False self . localrepo . save_json ( container_dir + "/container.json" , container_json ) status = self . _untar_layers ( layer_files , container_dir + "/ROOT" ) if not status : Msg ( ) . err ( "Error: creating container:" , self . container_id ) elif not self . _chk_container_root ( ) : Msg ( ) . out ( "Warning: check container content:" , self . container_id , l = Msg . WAR ) return self . container_id