diff --git a/data/model/image.py b/data/model/image.py index b019c6963..469f7606f 100644 --- a/data/model/image.py +++ b/data/model/image.py @@ -410,8 +410,10 @@ def synthesize_v1_image(repo, image_storage, docker_image_id, created_date_str, specified metadata. """ ancestors = '/' + parent_id = None if parent_image is not None: ancestors = '{0}{1}/'.format(parent_image.ancestors, parent_image.id) + parent_id = parent_image.id created = None if created_date_str is not None: @@ -423,7 +425,7 @@ def synthesize_v1_image(repo, image_storage, docker_image_id, created_date_str, return Image.create(docker_image_id=docker_image_id, ancestors=ancestors, comment=comment, command=command, v1_json_metadata=v1_json_metadata, created=created, - storage=image_storage, repository=repo) + storage=image_storage, repository=repo, parent_id=parent_id) def ensure_image_locations(*names): diff --git a/endpoints/v2/manifest.py b/endpoints/v2/manifest.py index 4bf2fefe4..392a4fbed 100644 --- a/endpoints/v2/manifest.py +++ b/endpoints/v2/manifest.py @@ -340,7 +340,7 @@ def _write_manifest(namespace, repo_name, manifest): raise ManifestInvalid(detail={'message': 'manifest does not reference any layers'}) # Store the manifest pointing to the tag. - leaf_layer = layers[0] + leaf_layer = layers[-1] model.tag.store_tag_manifest(namespace, repo_name, tag_name, leaf_layer.v1_metadata.docker_id, manifest_digest, request.data)