---
# System prepended metadata

title: Registry Acceptance

---

# Registry Acceptance

## :heavy_check_mark: `pack build --help` / `pack create-builder --help`

#### Output

```shell script
$ ./out/pack build --help
Generate app image from source code

Usage:
  pack build <image-name> [flags]

Flags:
  -B, --builder string              Builder image (default "some/image")
  -b, --buildpack strings           Buildpack reference in the form of '<buildpack>@<version>',
                                      path to a buildpack directory (not supported on Windows),
                                      path/URL to a buildpack .tar or .tgz file, or
                                      the name of a packaged buildpack image
                                    Repeat for each buildpack in order,
                                      or supply once by comma-separated list
  -R, --buildpack-registry string   Buildpack Registry URL
      --clear-cache                 Clear image's associated cache before building
  -D, --default-process string      Set the default process type
  -d, --descriptor string           Path to the project descriptor file
  -e, --env stringArray             Build-time environment variable, in the form 'VAR=VALUE' or 'VAR'.
                                    When using latter value-less form, value will be taken from current
                                      environment at the time this command is executed.
                                    This flag may be specified multiple times and will override
                                      individual values defined by --env-file.
      --env-file stringArray        Build-time environment variables file
                                    One variable per line, of the form 'VAR=VALUE' or 'VAR'
                                    When using latter value-less form, value will be taken from current
                                      environment at the time this command is executed
  -h, --help                        Help for 'build'
      --network string              Connect detect and build containers to network
      --no-pull                     Skip pulling builder and run images before use
  -p, --path string                 Path to app dir or zip-formatted file (defaults to current working directory)
      --publish                     Publish to registry
      --run-image string            Run image (defaults to default stack's run image)
      --volume stringArray          Mount host volume into the build container, in the form '<host path>:<target path>'. Target path will be prefixed with '/platform/'
                                    Repeat for each volume in order,
                                      or supply once by comma-separated list

Global Flags:
      --no-color     Disable color output
  -q, --quiet        Show less output
      --timestamps   Enable timestamps in output
  -v, --verbose      Show more output
┌─[javier.romero][Javiers-MacBook-Pro][±][rfc-0022 → origin {10} ✓][~/dev/pack]
└─▪ ./out/pack create-builder --help
Create builder image

Usage:
  pack create-builder <image-name> --builder-config <builder-config-path> [flags]

Flags:
  -b, --builder-config string       Path to builder TOML file (required)
  -R, --buildpack-registry string   Buildpack Registry URL
  -h, --help                        Help for 'create-builder'
      --no-pull                     Skip pulling build image before use
      --publish                     Publish to registry

Global Flags:
      --no-color     Disable color output
  -q, --quiet        Show less output
      --timestamps   Enable timestamps in output
  -v, --verbose      Show more output
```

```shell=
$ ./out/pack create-builder --help
Create builder image

Usage:
  pack create-builder <image-name> --builder-config <builder-config-path> [flags]

Flags:
  -b, --builder-config string       Path to builder TOML file (required)
  -R, --buildpack-registry string   Buildpack Registry URL
  -h, --help                        Help for 'create-builder'
      --no-pull                     Skip pulling build image before use
      --publish                     Publish to registry

Global Flags:
      --no-color     Disable color output
  -q, --quiet        Show less output
      --timestamps   Enable timestamps in output
  -v, --verbose      Show more output
```

## :heavy_check_mark: `pack build` when not able to connect to registry

#### Output
```shell script
$ ./out/pack build my-app -B cnbs/sample-builder:alpine -b urn:cnb:registry:example/foo -p ../samples/apps/bash-script/ -v
Using project descriptor located at ../samples/apps/bash-script/project.toml
Pulling image index.docker.io/cnbs/sample-builder:alpine
alpine: Pulling from cnbs/sample-builder
Digest: sha256:b7259fe1ab989ad962370eea2873e7dc66879ca275d7821636f71d377e53fae9
Status: Image is up to date for cnbs/sample-builder:alpine
Selected run image cnbs/sample-stack-run:alpine
Pulling image cnbs/sample-stack-run:alpine
alpine: Pulling from cnbs/sample-stack-run
Digest: sha256:bdfe5be3e39c2a1cf6d60ed38a46055e276a049932333903a0b6f060daf92005
Status: Image is up to date for cnbs/sample-stack-run:alpine
Refreshing registry cache for github.com//buildpacks/registry-index
Creating registry cache for github.com//buildpacks/registry-index
ERROR: locating in registry urn:cnb:registry:example/foo: refreshing cache: could not create registry cache: could not clone remote registry: authentication required
```

---

## :heavy_check_mark: `pack build -r <invalid registry>`


#### Output

```shell
$ ./out/pack build my-app -B cnbs/sample-builder:alpine -b urn:cnb:registry:example/foo -p ../samples/apps/bash-script/ -v -R /tmp/
Using project descriptor located at ../samples/apps/bash-script/project.toml
Pulling image index.docker.io/cnbs/sample-builder:alpine
alpine: Pulling from cnbs/sample-builder
Digest: sha256:b7259fe1ab989ad962370eea2873e7dc66879ca275d7821636f71d377e53fae9
Status: Image is up to date for cnbs/sample-builder:alpine
Selected run image cnbs/sample-stack-run:alpine
Pulling image cnbs/sample-stack-run:alpine
alpine: Pulling from cnbs/sample-stack-run
Digest: sha256:bdfe5be3e39c2a1cf6d60ed38a46055e276a049932333903a0b6f060daf92005
Status: Image is up to date for cnbs/sample-stack-run:alpine
Refreshing registry cache for //tmp/
Creating registry cache for //tmp/
ERROR: locating in registry urn:cnb:registry:example/foo: refreshing cache: could not create registry cache: could not clone remote registry: repository not found
```

---

## :heavy_check_mark: `pack create-builder` with `urn` in `uri` key

#### Output

```shell
$ cat ../samples/builders/alpine/builder.toml
# Buildpacks to include in builder
[[buildpacks]]
uri = "urn:cnb:registry:samples/hello-universe"

[[order]]
[[order.group]]
id = "samples/hello-universe"
version = "0.0.1"

# Stack that will be used by the builder
[stack]
id = "io.buildpacks.samples.stacks.alpine"
run-image = "cnbs/sample-stack-run:alpine"
build-image = "cnbs/sample-stack-build:alpine"

$ ./out/pack create-builder my-builder --builder-config ../samples/builders/alpine/builder.toml -R /var/folders/nx/x67fz2nj5hv_w43gn5h019hh0000gn/T/registry.hBN9UfoA -v
Pulling image cnbs/sample-stack-build:alpine
alpine: Pulling from cnbs/sample-stack-build
Digest: sha256:6d17681dfa4bbe62a4d8d22b088c9083c9a02153faf8db05ac5749d977e3606a
Status: Image is up to date for cnbs/sample-stack-build:alpine
Creating builder my-builder from build-image cnbs/sample-stack-build:alpine
Using cached version of https://github.com/buildpacks/lifecycle/releases/download/v0.7.2/lifecycle-v0.7.2+linux.x86-64.tgz
Refreshing registry cache for //var/folders/nx/x67fz2nj5hv_w43gn5h019hh0000gn/T/registry.hBN9UfoA
Validating registry cache for //var/folders/nx/x67fz2nj5hv_w43gn5h019hh0000gn/T/registry.hBN9UfoA
Creating registry cache for //var/folders/nx/x67fz2nj5hv_w43gn5h019hh0000gn/T/registry.hBN9UfoA
Pulling image localhost:5000/cnbs/sample-package@sha256:c68242ee63f084b50cca86d341bc7286d2b5c1223944e4b3e58038f00055ec80
sha256:c68242ee63f084b50cca86d341bc7286d2b5c1223944e4b3e58038f00055ec80: Pulling from cnbs/sample-package
Digest: sha256:c68242ee63f084b50cca86d341bc7286d2b5c1223944e4b3e58038f00055ec80
Status: Image is up to date for localhost:5000/cnbs/sample-package@sha256:c68242ee63f084b50cca86d341bc7286d2b5c1223944e4b3e58038f00055ec80
Successfully created builder image my-builder
Tip: Run pack build <image-name> --builder my-builder to use this builder
```

---

## :heavy_check_mark: `pack create-builder` with `urn` in `image` key


#### Output 

```shell
$ cat ../samples/builders/alpine/builder.toml
# Buildpacks to include in builder
[[buildpacks]]
image = "urn:cnb:registry:samples/hello-universe"

[[order]]
[[order.group]]
id = "samples/hello-universe"
version = "0.0.1"

# Stack that will be used by the builder
[stack]
id = "io.buildpacks.samples.stacks.alpine"
run-image = "cnbs/sample-stack-run:alpine"
build-image = "cnbs/sample-stack-build:alpine"

$ ./out/pack create-builder my-builder --builder-config ../samples/builders/alpine/builder.toml
alpine: Pulling from cnbs/sample-stack-build
Digest: sha256:6d17681dfa4bbe62a4d8d22b088c9083c9a02153faf8db05ac5749d977e3606a
Status: Image is up to date for cnbs/sample-stack-build:alpine
ERROR: invalid image format: urn:cnb:registry:samples/hello-universe
```



## :heavy_check_mark: `pack build -r <valid registry>`

```shell
$ ./out/pack inspect-builder cnbs/sample-builder:alpine
Inspecting builder: cnbs/sample-builder:alpine


LOCAL:

Created By:
  Name: Pack CLI
  Version: 0.10.0+git-06d9983.build-259

Stack:
  ID: io.buildpacks.samples.stacks.alpine

Lifecycle:
  Version: 0.7.2
  Buildpack API: 0.2
  Platform API: 0.3

Run Images:
  cnbs/sample-stack-run:alpine

Buildpacks:
  ID                                          VERSION        HOMEPAGE
  buildpacks-io-samples/java-maven            0.0.1          https://github.com/buildpacks/samples/tree/master/buildpacks/java-maven
  buildpacks-io-samples/kotlin-gradle         0.0.1          https://github.com/buildpacks/samples/tree/master/buildpacks/kotlin-gradle
  buildpacks-io-samples/hello-universe        0.0.1          https://github.com/buildpacks/samples/tree/master/buildpacks/hello-universe
  buildpacks-io-samples/hello-moon            0.0.1          https://github.com/buildpacks/samples/tree/master/buildpacks/hello-moon
  buildpacks-io-samples/hello-world           0.0.1          https://github.com/buildpacks/samples/tree/master/buildpacks/hello-world

Detection Order:
  Group #1:
    buildpacks-io-samples/java-maven@0.0.1
  Group #2:
    buildpacks-io-samples/kotlin-gradle@0.0.1
  Group #3:
    buildpacks-io-samples/hello-universe@0.0.1
    
$ ./out/pack build my-app -B cnbs/sample-builder:alpine -b urn:cnb:registry:samples/hello-world -p ../samples/apps/bash-script/ -v -r /var/folders/nx/x67fz2nj5hv_w43gn5h019hh0000gn/T/registry.y8vZ7nc1
Using project descriptor located at ../samples/apps/bash-script/project.toml
...
Pulling image localhost:5000/cnbs/sample-package@sha256:a26a307915d5ed20f05261c33c4143822cc57d3794315fa2b0083de4d86d8a76
sha256:a26a307915d5ed20f05261c33c4143822cc57d3794315fa2b0083de4d86d8a76: Pulling from cnbs/sample-package
Digest: sha256:a26a307915d5ed20f05261c33c4143822cc57d3794315fa2b0083de4d86d8a76
Status: Image is up to date for localhost:5000/cnbs/sample-package@sha256:a26a307915d5ed20f05261c33c4143822cc57d3794315fa2b0083de4d86d8a76
Adding buildpack samples/hello-world version 0.0.1 to builder
Setting custom order
Using build cache volume pack-cache-cbd6ecf04229.build
===> DETECTING
[detector] ======== Results ========
[detector] pass: samples/hello-world@0.0.1
[detector] Resolving plan... (try #1)
[detector] samples/hello-world 0.0.1
===> ANALYZING
[analyzer] Analyzing image "038d3966ef0e8ef14e36a36aa7481d48ce68964723dddb7c1ee7bd3ae6eae3dc"
===> RESTORING
===> BUILDING
...
===> EXPORTING
[exporter] no project metadata found at path './project-metadata.toml', project metadata will not be exported
[exporter] Reusing layers from image with id '038d3966ef0e8ef14e36a36aa7481d48ce68964723dddb7c1ee7bd3ae6eae3dc'
[exporter] Writing tarball for layer "launcher"
[exporter] Reusing layer 'launcher'
[exporter] Layer 'launcher' SHA: sha256:c189102796b1e6d38ccb28796cf6b65e1a5541f619367d0a7cd479785bf21a7c
[exporter] Layer 'app' SHA: sha256:4c6ff16e28deaf437a1abe5c926cdfb8afcd2c31ea544f6992ed7b665965b3f4
[exporter] Reusing 1/1 app layer(s)
[exporter] Writing tarball for layer "config"
[exporter] Reusing layer 'config'
[exporter] Layer 'config' SHA: sha256:fb8316ee68aad907adf0fda56908b2fc3c699c287ed13ab30e55ed7efe703bad
[exporter] *** Images (038d3966ef0e):
[exporter]       index.docker.io/library/my-app:latest
[exporter]
[exporter] *** Image ID: 038d3966ef0e8ef14e36a36aa7481d48ce68964723dddb7c1ee7bd3ae6eae3dc
Successfully built image my-app
```

# Additional Sugestions

- [ ] Create an issue to support buildpacks from registry via `cnb://[<host>]/[<id>[@<version>]]`.
- [ ] Create an issue to enable configuring the default registry.
- [ ] Create an issue to gate registry functionallity behind "experimental".