From 8e783e356b091d41224a4ad82630d26895fa5289 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Wed, 20 Nov 2024 18:56:05 +0100 Subject: [PATCH] Add note to configure the env var CNB_REGISTRY_AUTH. #95 Signed-off-by: cmoulliard --- README.md | 9 ++++++++- samples/build-me/README.md | 9 ++++++++- samples/build-me/src/main/java/dev/snowdrop/BuildMe.java | 3 ++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe8ae83..835690c 100644 --- a/README.md +++ b/README.md @@ -228,12 +228,19 @@ and execute this command in a terminal: ```bash mvn compile exec:java ``` -**Important**: To avoid the `docker rate limit` error, set the following env var too +**Important**: To avoid the `docker rate limit` error, set the following env var: ```bash export REGISTRY_USERNAME="" export REGISTRY_PASSWORD="" export REGISTRY_SERVER="docker.io" ``` +and also set this one to let `lifecycle` to get rid of the docker limit: +```bash +export CNB_REGISTRY_AUTH="'{"index.docker.io":"Basic "}'" + +// Replace ` text with +echo -n "username:password" | base64 +``` ### Jbang diff --git a/samples/build-me/README.md b/samples/build-me/README.md index a49c5ea..b18259f 100644 --- a/samples/build-me/README.md +++ b/samples/build-me/README.md @@ -14,9 +14,16 @@ and execute this command in a terminal: mvn compile exec:java ``` -**Important**: To avoid the `docker rate limit` error, set the following env var too +**Important**: To avoid the `docker rate limit` error, set the following env var: ```bash export REGISTRY_USERNAME="" export REGISTRY_PASSWORD="" export REGISTRY_SERVER="docker.io" +``` +and also set this one to let `lifecycle` to get rid of the docker limit: +```bash +export CNB_REGISTRY_AUTH="'{"index.docker.io":"Basic "}'" + +// Replace ` text with +echo -n "username:password" | base64 ``` \ No newline at end of file diff --git a/samples/build-me/src/main/java/dev/snowdrop/BuildMe.java b/samples/build-me/src/main/java/dev/snowdrop/BuildMe.java index 57928b5..abf067b 100644 --- a/samples/build-me/src/main/java/dev/snowdrop/BuildMe.java +++ b/samples/build-me/src/main/java/dev/snowdrop/BuildMe.java @@ -28,8 +28,9 @@ public static void main(String... args) { Map envMap = new HashMap<>(); envMap.put("BP_JVM_VERSION", "21"); + envMap.put("CNB_REGISTRY_AUTH",System.getenv("CNB_REGISTRY_AUTH")); + // envMap.put("CNB_LOG_LEVEL","debug"); // envMap.put("BP_MAVEN_BUILT_ARTIFACT","target/quarkus-app/lib/ target/quarkus-app/*.jar target/quarkus-app/app/ target/quarkus-app/quarkus"); - // envMap.put("CNB_LOG_LEVEL","trace"); DockerClient client = getDockerClient(); client.authConfig()