Home > Enterprise >  How to publish a docker image using buildpack's `pack build --publish`?
How to publish a docker image using buildpack's `pack build --publish`?

Time:03-27

I am using buildpack to build a docker container, and I want to publish it to a remote container registry.

I am using this command:

pack build myapp --builder heroku/buildpacks:20 --publish

However, this yields the following error:

ERROR: failed to : ensure registry read access to myapp
ERROR: failed to build: executing lifecycle: failed with status code: 1

How can I specify the remote registry URL and credentials? I tried running docker login before running my command but received the same error. The documentation only says the following:

--publish                     Publish to registry

CodePudding user response:

It follows the same principles as docker tag and docker push.

  1. You need to docker login to your target registry first. pack will also use this to authenticate with your target registry.

  2. You need to use the format <registry-host>:<port>/<project>/<image>:<tag> for the value of your image name. This is the same as with docker push and this is how both utilities know where to send the image.

    https://docs.docker.com/engine/reference/commandline/push/#push-a-new-image-to-a-registry

For example:

pack build docker.io/user/myapp:v1.0 --builder heroku/buildpacks:20 --publish
  • Related