redhat-buildpacks / testing

Project aiming to help us to perform e2e tests using Buildpacks
Apache License 2.0
0 stars 3 forks source link

pack build fails to connect to docker socket: dial unix /var/run/docker.sock #57

Open cmoulliard opened 2 months ago

cmoulliard commented 2 months ago

Issue

This command executed in a PipelineRun fails

            #!/usr/bin/env bash
            set -e

            echo "Installing pack ..."
            curl -sSL "https://github.com/buildpacks/pack/releases/download/$(params.PACK_CLI_VERSION)/pack-$(params.PACK_CLI_VERSION)-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack

            echo "Checking pack ..."
            pack --version

            export DOCKER_HOST=tcp://$(params.DOCKER_HOST):2376
            echo "DOCKER_HOST=tcp://$(params.DOCKER_HOST):2376"

            # We cannot get the array from the params PACK_CMD_FLAGS within the bash script as substitution don't work in this case !!
            echo "Getting the arguments ..."
            for cmd_arg in "$@"; do
              CLI_ARGS+=("$cmd_arg")
            done

            echo "Here are the arguments to be passed to the pack CLI"
            for i in "$CLI_ARGS[@]"; do
              echo "arg: $i"
            done

            echo "Building the image ..."
            echo "pack ${CLI_ARGS[@]}"
            pack "${CLI_ARGS[@]}"

Log of the tekton's pod

step-run-script
Installing pack ...
pack
Checking pack ...
0.35.1+git-3a22a7f.build-6099
DOCKER_HOST=tcp://10.128.3.31:2376

pack build -B quay.io/snowdrop/ubi-builder -e BP_JVM_VERSION=21 quarkus-hello:1.0 -v

Builder 'quay.io/snowdrop/ubi-builder' is untrusted
As a result, the phases of the lifecycle which require root access will be run in separate trusted ephemeral containers.
For more information, see https://medium.com/buildpacks/faster-more-secure-builds-with-pack-0-11-0-4d0c633ca619
Pulling image 'quay.io/snowdrop/ubi-builder:latest'
b4c430afd059: Already exists
cb1b671f280a: Already exists
fdbb3dc4329d: Already exists
b01d091c9f46: Already exists
6624cf5d5eb9: Already exists
4067c716c8b4: Already exists
2d1dd67d74bd: Already exists
2b6c19543f82: Already exists
881fd6da3e87: Already exists
706c344835f2: Already exists
3e5bb33c84b6: Already exists
b95e27d077d2: Already exists
43acf3b30dc7: Already exists
51d93d6093cb: Already exists
dc758e03975a: Already exists
8f600e6d4576: Already exists
ac97cd8fef83: Already exists
d30b920f16aa: Already exists
5d39e759bb7b: Already exists
3625f436d8ff: Already exists
5f2bdaa43054: Already exists
7c376ce3369b: Already exists
0e576d41fbcf: Already exists
9ee3c01b2c74: Already exists
9c92f41877d9: Already exists
c88ed97c289f: Already exists
7db836aa4d59: Already exists
396d6f674d17: Already exists
35c8c32f3476: Already exists
febcb58a96f7: Already exists
3b604ef5e98c: Already exists
f8ef9c04a3f6: Already exists
1c4ca450f9f3: Already exists
db465c0a7a1c: Already exists
f6305680dc6d: Already exists
6b2482ff760c: Already exists
23fae3d0a80d: Already exists
e8e4703a5455: Already exists
42fece303136: Already exists
3416498bc66a: Already exists
1dfcf3c1bee4: Already exists
90af588e31da: Already exists
415893308841: Already exists
73ce1cdc8e82: Already exists
26baa1925f13: Already exists
cf1b481bca5f: Already exists
cc786ab82511: Already exists
aa2ec0a39e90: Already exists
b2210e20e368: Already exists
a763088f2b52: Already exists
89732bc75041: Already exists
68d51ed7b660: Pulling fs layer
68d51ed7b660: Download complete
68d51ed7b660: Download complete
CheckReadAccess succeeded for the run image index.docker.io/paketocommunity/run-ubi-base:latest
Selected run image 'index.docker.io/paketocommunity/run-ubi-base:latest'
Pulling image 'index.docker.io/paketocommunity/run-ubi-base:latest' with platform 'linux/amd64'
a30895ae170c: Already exists
fb168a0cbc3f: Already exists
5d420b0b11f0: Already exists
1418e2c6c90e: Pulling fs layer
1418e2c6c90e: Download complete
1418e2c6c90e: Download complete
Pulling image 'buildpacksio/lifecycle:0.19.7' with platform 'linux/amd64'
33e068de2649: Already exists
b2ce0e066077: Already exists
e8d9a567199d: Already exists
058cf3d8c2ba: Already exists
b6824ed73363: Already exists
7c12895b777b: Already exists
5664b15f108b: Already exists
27be814a09eb: Already exists
4aa0ea1413d3: Already exists
da7816fa955e: Already exists
9aee425378d2: Already exists
68f20d2f8571: Already exists
43984d0cc9f6: Pulling fs layer
43984d0cc9f6: Download complete
43984d0cc9f6: Download complete
Creating ephemeral lifecycle from buildpacksio/lifecycle:0.19.7 with uid 1002 and gid 1000. With workspace dir 
Selecting ephemeral lifecycle image pack.local/lifecycle/6677687372697a696671:latest for build
Creating builder with the following buildpacks:
-> 'paketo-community/ubi-java-buildpack@0.1.1'
-> 'paketo-buildpacks/quarkus@0.4.0'
-> 'paketo-buildpacks/java@15.1.0'
-> 'paketo-buildpacks/apache-tomcat@8.1.1'
-> 'paketo-buildpacks/apache-tomee@1.10.1'
-> 'paketo-buildpacks/azure-application-insights@5.21.2'
-> 'paketo-buildpacks/bellsoft-liberica@10.8.1'
-> 'paketo-buildpacks/ca-certificates@3.8.2'
-> 'paketo-buildpacks/clojure-tools@2.10.1'
-> 'paketo-buildpacks/datadog@5.15.0'
-> 'paketo-buildpacks/dist-zip@5.8.1'
-> 'paketo-buildpacks/encrypt-at-rest@4.7.2'
-> 'paketo-buildpacks/environment-variables@4.7.0'
-> 'paketo-buildpacks/executable-jar@6.10.1'
-> 'paketo-buildpacks/google-stackdriver@9.0.3'
-> 'paketo-buildpacks/gradle@7.12.1'
-> 'paketo-buildpacks/image-labels@4.7.0'
-> 'paketo-buildpacks/jattach@1.8.1'
-> 'paketo-buildpacks/java-memory-assistant@1.6.1'
-> 'paketo-buildpacks/leiningen@4.9.1'
-> 'paketo-buildpacks/liberty@4.2.1'
-> 'paketo-buildpacks/maven@6.17.3'
-> 'paketo-buildpacks/node-engine@4.1.0'
-> 'paketo-buildpacks/procfile@5.9.0'
-> 'paketo-buildpacks/sbt@6.15.1'
-> 'paketo-buildpacks/spring-boot@5.30.1'
-> 'paketo-buildpacks/syft@1.47.1'
-> 'paketo-buildpacks/watchexec@3.2.0'
-> 'paketo-buildpacks/yarn@1.3.4'
-> 'paketo-buildpacks/nodejs@3.0.1'
-> 'paketo-buildpacks/ca-certificates@3.8.3'
-> 'paketo-buildpacks/datadog@3.6.0'
-> 'paketo-buildpacks/environment-variables@4.7.0'
-> 'paketo-buildpacks/image-labels@4.7.0'
-> 'paketo-buildpacks/node-engine@4.1.1'
-> 'paketo-buildpacks/node-run-script@1.0.19'
-> 'paketo-buildpacks/node-start@2.0.1'
-> 'paketo-buildpacks/npm-install@1.4.3'
-> 'paketo-buildpacks/npm-start@2.0.1'
-> 'paketo-buildpacks/procfile@5.9.0'
-> 'paketo-buildpacks/watchexec@3.2.1'
-> 'paketo-buildpacks/yarn@1.3.5'
-> 'paketo-buildpacks/yarn-install@2.0.1'
-> 'paketo-buildpacks/yarn-start@2.0.1'
-> 'paketo-buildpacks/procfile@5.9.0'
Provided Environment Variables
  'BP_JVM_VERSION=21'
Warning: PACK_VOLUME_KEY is unset; set this environment variable to a secret value to avoid creating a new volume cache on every build
Using build cache volume 'pack-cache-library_quarkus-hello_1.0-ccd10301af78.build'
Created ephemeral bridge network pack.local-network-6372766a6b7575616d77 with ID c3e5683da4cdf0e2dc0094768326bd9baa18c8da8ffc12b4495ffa074eabaa41
===> ANALYZING
Running the 'analyzer' on OS 'linux' from image 'pack.local/lifecycle/6677687372697a696671:latest' with:
Container Settings:
  Args: '/cnb/lifecycle/analyzer -log-level debug -daemon -run /layers/run.toml -run-image index.docker.io/paketocommunity/run-ubi-base:latest -launch-cache /launch-cache quarkus-hello:1.0'
  System Envs: 'CNB_USER_ID=1002 CNB_GROUP_ID=1000 CNB_PLATFORM_API=0.13'
  Image: 'pack.local/lifecycle/6677687372697a696671:latest'
  User: 'root'
  Labels: 'map[author:pack]'
Host Settings:
  Binds: '/var/run/docker.sock:/var/run/docker.sock pack-cache-library_quarkus-hello_1.0-ccd10301af78.launch:/launch-cache pack-layers-zzcvlttkmr:/layers pack-app-rkhxcroxah:/workspace'
  Network Mode: 'pack.local-network-6372766a6b7575616d77'
[analyzer] Starting analyzer...
[analyzer] Parsing inputs...
[analyzer] Ensuring privileges...
[analyzer] ERROR: failed to initialize docker client: failed to connect to docker socket: dial unix /var/run/docker.sock: connect: connection refused
ERROR: failed to build: executing lifecycle: failed with status code: 1