google / google/go-containerregistry

crane: push command erroring with "file manifest.json not found in tar"

Open
#2,109 4 comments 2 reactions 0 assignees View on GitHub
bug lifecycle/stale
Dominant language
Go
Stars
4k
Forks
686
Avg merge
2d 12h
Merged PRs (30d)
26

Description

### Describe the bug

I am using `buildkit` to build my image and then using `crane` to authenticate to a registry and push the image.

[Here](https://crazymax.dev/buildkit/usage/output/) are some docs about the `buildctl build` command, specifically, the `output` option.

The command I am running to build the image is:
```
buildctl build \
--frontend dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--output type=oci,dest=my-image.tar
```

This creates a `my-image.tar` OCI tarball file in the current working directory.

I am then authenticating to a private AWS ECR using `aws ecr get-login-password --region ${region} | crane auth login --username AWS --password-stdin ${ecrRegistryUrl}")` and attempting to run `crane push my-image.tar ${ecrRegistryUrl}/my-repo/my-image:latest`, but I get an error: `Error: loading my-image.tar as tarball: file manifest.json not found in tar`

### To Reproduce

1. Install `buildkit`/`buildctl` for whatever OS you run.
2. Install `crane`
3. Build an image using `buildctl build ...` and make sure to save it as an OCI tarball using the flags `--output type=oci,dest=my-image-tarball.tar`
4. Attempt to push the image using `crane push`

### Expected behavior

I would expect the `crane push` to work is all.

### Anything else
```
❯ crane version
0.20.5
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.