Sanket Meghani
Sanket Meghani

Reputation: 905

Buildpack - saving image: failed to write image to the following tags

I am trying to publish buildpack image to a private OCI repository. I am using --publish option. However it fails with following error:

ERROR: saving image: failed to write image to the following tags: [java-maven-buildpack:1.0: HEAD https://index.docker.io/v2/library/java-maven-buildpack/blobs/sha256:cfe02c20a60fb987f86a2b5256b0c83cde981919d0953a7645cf2a9e2c7f6357: unexpected status code 401 Unauthorized (HEAD responses have no body, use GET for details)]

I am using following command to create and publish buildpack to OCI repository.

pack buildpack package  java-maven-buildpack:1.0 --config ./java-maven-buildpack/package.toml --verbose --publish --format "image"

Not sure what I am missing. Pointers towards any example or documents would help.

Upvotes: 0

Views: 1558

Answers (3)

samj1912
samj1912

Reputation: 106

If you are using the --publish flag with pack, you need to make sure that you are authorized to the registry you are publishing to. You can do this via docker login.

Also make sure that you have access to the repository you are publishing to. For example if you are publishing to docker hub to your personal namespace you probably want something like

pack buildpack package <hub-user>/java-maven-buildpack:1.0 --config ./java-maven-buildpack/package.toml --verbose --publish --format "image"

Upvotes: 2

Anthony Dahanne
Anthony Dahanne

Reputation: 5033

Do you own the java-maven-buildpack repository on dockerhub ?

If not, I suggest you to push to your own account / repository on Dockerhub, using:

pack buildpack package  youraccount/java-maven-buildpack:1.0 --config ./java-maven-buildpack/package.toml --publish

Upvotes: 1

rassakra
rassakra

Reputation: 1121

To push an image to a private registry you need to follow this steps:

1. Tag your image like that:

docker image tag <local-image>:<image-tag> <registry-host>:<ragistry-port>/<your-name-on-the-registry>/<remote-image-name>:<remote-image-tag>

Example:

docker image tag rhel-httpd:latest registry-host:5000/myadmin/rhel-httpd:latest

Notice: In this example the registry is on host named registry-host and listening on port 5000

After that :

2. Push your image:

docker image push <registry-host>:<ragistry-port>/<your-name-on-the-registry>/<remote-image-name>:<remote-image-tag>

Example:

 docker image push registry-host:5000/myadmin/rhel-httpd:latest

I hope that this can help you to resolve your Isuue.

Upvotes: 0

Related Questions