(self, tarfile, imagerepo, tag, container_name)
return container_id
Import a tar file containing a simple directory tree possibly
        created with Docker export and create local container ready to use
Import a tar file containing a simple directory tree possibly
        created with Docker export and create local container ready to use
Import a tar file containing a simple directory tree possibly created with Docker export and create local container ready to use
def import_tocontainer(self, tarfile, imagerepo, tag, container_name):
        """Import a tar file containing a simple directory tree possibly
        created with Docker export and create local container ready to use"""
        if not imagerepo:
            imagerepo = "IMPORTED"
            tag = "latest"
        if not os.path.exists(tarfile) and tarfile != '-':
            Msg().err("Error: tar file does not exist:", tarfile)
            return False
        if container_name:
            if self.localrepo.get_container_id(container_name):
                Msg().err("Error: container name already exists:",
                          container_name)
                return False
        layer_id = Unique().layer_v1()
        container_json = self.create_container_meta(layer_id)
        container_id = ContainerStructure(self.localrepo).create_fromlayer(
            imagerepo, tag, tarfile, container_json)
        if container_name:
            self.localrepo.set_container_name(container_id, container_name)
        return container_id
def import_tocontainer ( self , tarfile , imagerepo , tag , container_name ) : if not imagerepo : imagerepo = "IMPORTED" tag = "latest" if not os . path . exists ( tarfile ) and tarfile != '-' : Msg ( ) . err ( "Error: tar file does not exist:" , tarfile ) return False if container_name : if self . localrepo . get_container_id ( container_name ) : Msg ( ) . err ( "Error: container name already exists:" , container_name ) return False layer_id = Unique ( ) . layer_v1 ( ) container_json = self . create_container_meta ( layer_id ) container_id = ContainerStructure ( self . localrepo ) . create_fromlayer ( imagerepo , tag , tarfile , container_json ) if container_name : self . localrepo . set_container_name ( container_id , container_name ) return container_id