original_docstring: Creates a Docker image from a list of layers.
  
    Args:
      output: the name of the docker image file to create.
      layers: the layers (tar files) to join to the image.
      identifier: the identifier of the top layer for this image.
      name: symbolic name for this docker image.
      repository: repository name for this docker image.
    
docstring: Creates a Docker image from a list of layers.
docstring_tokens: Creates a Docker image from a list of layers .
code: def create_image(output, layers, identifier=None,
                   name=None, repository=None):
    """Creates a Docker image from a list of layers.
  
    Args:
      output: the name of the docker image file to create.
      layers: the layers (tar files) to join to the image.
      identifier: the identifier of the top layer for this image.
      name: symbolic name for this docker image.
      repository: repository name for this docker image.
    """
    manifest = []
  
    tar = archive.TarFileWriter(output)
    for layer in layers:
      tar.add_tar(layer, name_filter=_layer_filter)
      manifest += utils.GetManifestFromTar(layer)
  
    manifest_content = json.dumps(manifest, sort_keys=True)
    tar.add_file('manifest.json', content=manifest_content)
  
    # In addition to N layers of the form described above, there might be
    # a single file at the top of the image called repositories.
    # This file contains a JSON blob of the form:
    # {
    #   'repo':{
    #     'tag-name': 'top-most layer hex',
    #     ...
    #   },
    #   ...
    # }
    if identifier:
      # If the identifier is not provided, then the resulted layer will be
      # created without a 'top' file. Docker doesn't needs that file nor
      # the repository to load the image and for intermediate layer,
      # docker_build store the name of the layer in a separate artifact so
      # this 'top' file is not needed.
      tar.add_file('top', content=identifier)
      if repository and name:
        tar.add_file('repositories',
                     content='\n'.join([
                         '{', '  "%s": {' % repository, '    "%s": "%s"' % (
                             name, identifier), '  }', '}'
                     ]))
code_tokens: def create_image ( output , layers , identifier = None , name = None , repository = None ) : manifest = [ ] tar = archive . TarFileWriter ( output ) for layer in layers : tar . add_tar ( layer , name_filter = _layer_filter ) manifest += utils . GetManifestFromTar ( layer ) manifest_content = json . dumps ( manifest , sort_keys = True ) tar . add_file ( 'manifest.json' , content = manifest_content ) if identifier : tar . add_file ( 'top' , content = identifier ) if repository and name : tar . add_file ( 'repositories' , content = '\n' . join ( [ '{' , '  "%s": {' % repository , '    "%s": "%s"' % ( name , identifier ) , '  }' , '}' ] ) )
short_docstring: Creates a Docker image from a list of layers.
short_docstring_tokens: Creates a Docker image from a list of layers .
comment: """Creates a Docker image from a list of layers.
  
    Args:
      output: the name of the docker image file to create.
      layers: the layers (tar files) to join to the image.
      identifier: the identifier of the top layer for this image.
      name: symbolic name for this docker image.
      repository: repository name for this docker image.
    """$SEP$# In addition to N layers of the form described above, there might be$SEP$# a single file at the top of the image called repositories.$SEP$# This file contains a JSON blob of the form:$SEP$# {$SEP$#   'repo':{$SEP$#     'tag-name': 'top-most layer hex',$SEP$#     ...$SEP$#   },$SEP$#   ...$SEP$# }$SEP$# If the identifier is not provided, then the resulted layer will be$SEP$# created without a 'top' file. Docker doesn't needs that file nor$SEP$# the repository to load the image and for intermediate layer,$SEP$# docker_build store the name of the layer in a separate artifact so$SEP$# this 'top' file is not needed.