Failed to build and push docker image (OD-2385)
hichemmejri opened 8 months ago

Capture d’écran 2025-04-28 152928.png

  • hichemmejri changed title 8 months ago
    Previous Value Current Value
    failed to build  and push docker image  :
    failed to build  and push docker image  : Step "detect build version" is successful (7 seconds) 15:31:11 Running step "Set build version"... 15:31:11 Step "Set build version" is successful (0 seconds) 15:31:11 Running step "build & push image"... 15:31...
  • Robin Shen changed title 8 months ago
    Previous Value Current Value
    failed to build  and push docker image  : Step "detect build version" is successful (7 seconds) 15:31:11 Running step "Set build version"... 15:31:11 Step "Set build version" is successful (0 seconds) 15:31:11 Running step "build & push image"... 15:31...
    Failed to build  and push docker image
  • Robin Shen commented 8 months ago

    Does the build log contain any error message?

  • hichemmejri commented 8 months ago

    no, any help please !

  • Robin Shen commented 8 months ago

    Please attach git repository of an example project so that I can be test here to see what might be wrong.

  • hichemmejri commented 8 months ago

    i didn't get it , can you explain how !

  • hichemmejri commented 8 months ago
    Running step "build & push image"...
    13:04:47 #0 building with "onedev" instance using docker-container driver
    13:04:47 
    13:04:47 #1 [internal] load build definition from Dockerfile
    13:04:47 #1 transferring dockerfile: 176B 0.0s done
    13:04:47 #1 DONE 0.0s
    13:04:47 
    13:04:47 #2 [internal] load metadata for docker.io/library/openjdk:17-jdk-alpine
    13:04:48 #2 DONE 1.0s
    13:04:48 
    13:04:49 #3 [internal] load .dockerignore
    13:04:49 #3 transferring context: 2B 0.0s done
    13:04:49 #3 DONE 0.0s
    13:04:49 
    13:04:49 #4 [1/2] FROM docker.io/library/openjdk:17-jdk-alpine@sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81
    13:04:49 #4 resolve docker.io/library/openjdk:17-jdk-alpine@sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81 0.0s done
    13:04:49 #4 DONE 0.0s
    13:04:49 
    13:04:49 #5 [internal] load build context
    13:04:50 #5 transferring context: 57.72MB 1.7s done
    13:04:50 #5 DONE 1.7s
    13:04:50 
    13:04:50 #4 [1/2] FROM docker.io/library/openjdk:17-jdk-alpine@sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81
    13:04:50 #4 CACHED
    13:04:50 
    13:04:50 #6 [2/2] ADD target/tp-foyer-5.0.0.jar tp-foyer-5.0.0.jar
    13:04:50 #6 DONE 0.4s
    13:04:51 
    13:04:51 #7 exporting to image
    13:04:51 #7 exporting layers
    13:04:52 #7 exporting layers 2.0s done
    13:04:53 #7 exporting manifest sha256:b83dc0ae44fdd9445d292dd66120efd63a1121a16057a68cc1e0184a183c22aa done
    13:04:53 #7 exporting config sha256:200139dd56cac9c0585c1dcf16947d7bdeb2af2c3ff1c84fd8f8456cb8785ed0 done
    13:04:53 #7 exporting attestation manifest sha256:0452a31fa5bbbf801a92c353436c2c086ce4e99319112e3c3731c1868d111440 0.0s done
    13:04:53 #7 exporting manifest list sha256:4920927b8a08bba261234cf28ef711e46e3d252938091f32484064343b9c6d8a done
    13:04:53 #7 pushing layers 0.0s done
    13:04:53 #7 ERROR: failed to push 192.168.100.26:6610/hichemmejri/tp_foyer:latest: failed to do request: Head "https://192.168.100.26:6610/v2/hichemmejri/tp_foyer/blobs/sha256:5843afab387455b37944e709ee8c78d7520df80f8d01cf7f861aae63beeddb6b": http: server gave HTTP response to HTTPS client
    13:04:53 ------
    13:04:53  > exporting to image:
    13:04:53 ------
    13:04:53 ERROR: failed to solve: failed to push 192.168.100.26:6610/hichemmejri/tp_foyer:latest: failed to do request: Head "https://192.168.100.26:6610/v2/hichemmejri/tp_foyer/blobs/sha256:5843afab387455b37944e709ee8c78d7520df80f8d01cf7f861aae63beeddb6b": http: server gave HTTP response to HTTPS client
    13:04:53 Command execution failed (command: docker buildx build --builder onedev --pull . --push -t 192.168.100.26:6610/hichemmejri/tp_foyer:latest, exit code: 1)
    13:04:55 Job finished
    
  • Robin Shen commented 8 months ago
    13:04:53 #7 ERROR: failed to push 192.168.100.26:6610/hichemmejri/tp_foyer:latest: failed to do request: Head "https://192.168.100.26:6610/v2/hichemmejri/tp_foyer/blobs/sha256:5843afab387455b37944e709ee8c78d7520df80f8d01cf7f861aae63beeddb6b": http: server gave HTTP response to HTTPS client
    

    Above error means that docker rejects to push to registry running with http protocol. Either configure OneDev server to run with https protocol with a valid certificate, or follow below tutorial to configure docker to accept http registry:

    https://docs.onedev.io/tutorials/cicd/insecure-docker-registry

  • hichemmejri commented 8 months ago

    should i run a new container for the last command !" If OneDev runs inside docker container, you also need to mount the buildx config into the container via below option so that the builder can be accessed inside container:

    -v /.docker/buildx:/root/.docker/buildx" this command docker run -v should contain an image .

  • Robin Shen commented 8 months ago

    should i run a new container for the last command !" If OneDev runs inside docker container, you also need to mount the buildx config into the container via below option so that the builder can be accessed inside container:

    -v /.docker/buildx:/root/.docker/buildx" this command docker run -v should contain an image .

    What do you mean?

  • hichemmejri commented 8 months ago

    https://docs.onedev.io/tutorials/cicd/insecure-docker-registry : in this page i found commandes ,i did it but the last one "-v /.docker/buildx:/root/.docker/buildx " should take an argumant like image or to start a new container onedev with it to mount the config , because there is no command that start with -v , thats what i m asking about .

  • hichemmejri commented 8 months ago

    when i creat a job build docker image : exporting to image 16:44:27 #7 exporting layers 16:44:28 #7 exporting layers 1.9s done 16:44:28 #7 exporting manifest sha256:e37d1a80aa9775d66adce2ec43294493162c61cb29305c391a6221292f1f069e 16:44:29 #7 exporting manifest sha256:e37d1a80aa9775d66adce2ec43294493162c61cb29305c391a6221292f1f069e 0.0s done 16:44:29 #7 exporting config sha256:e4d88d154ff2d87801370dcc14cace38c4b1675cc389de59b34c7fbb2faac5f8 done 16:44:29 #7 exporting attestation manifest sha256:ce07b9c8b223fbd2b442da879c7be14d65bdf25a2a88a11069b98710388cd583 0.0s done 16:44:29 #7 exporting manifest list sha256:0f7c1ed876a45dafbb8ce9c911816a5466cdb1a40e7c50cb4e70e8cf605a6ecb 0.0s done 16:44:29 #7 pushing layers 0.0s done 16:44:29 #7 ERROR: failed to push 192.168.100.30:6610/hichemmejri/tp_foyer:latest: failed to do request: Head "https://192.168.100.30:6610/v2/hichemmejri/tp_foyer/blobs/sha256:53c9466125e464fed5626bde7b7a0f91aab09905f0a07e9ad4e930ae72e0fc63": http: server gave HTTP response to HTTPS client 16:44:29 ------ 16:44:29 > exporting to image: 16:44:29 ------ 16:44:29 ERROR: failed to solve: failed to push 192.168.100.30:6610/hichemmejri/tp_foyer:latest: failed to do request: Head "https://192.168.100.30:6610/v2/hichemmejri/tp_foyer/blobs/sha256:53c9466125e464fed5626bde7b7a0f91aab09905f0a07e9ad4e930ae72e0fc63": http: server gave HTTP response to HTTPS client 16:44:29 Command execution failed (command: docker buildx build --builder onedev --pull . --push -t 192.168.100.30:6610/hichemmejri/tp_foyer:latest, exit code: 1). can you give all the instructions please to solve this problem or if there is another solution de build and push image .

  • Robin Shen commented 8 months ago

    This is an extra option for step 4.

  • hichemmejri commented 8 months ago

    should i do all the instructions in this page , and the option 4 should include this -v /.docker/buildx:/root/.docker/buildx ?

  • Robin Shen commented 8 months ago

    Yes, please follow instructions on the page step by step

  • Robin Shen changed state to 'Closed' 8 months ago
    Previous Value Current Value
    Open
    Closed
  • hichemmejri commented 8 months ago

    docker buildx create --name onedevv --config /etc/buildkit/buildkitd.toml -v $HOME/.docker/buildx:/root/.docker/buildx unknown shorthand flag: 'v' in -v See 'docker buildx create --help'. buildx create cant support option -v thats what i m talking about !

  • hichemmejri commented 8 months ago

    option -v it's not supported for docker buildx create

  • hichemmejri changed state to 'Open' 8 months ago
    Previous Value Current Value
    Closed
    Open
  • Robin Shen commented 8 months ago

    My mistake. The -v option should be added to the command launching OneDev docker container. Will improve the doc to make this clear.

  • hichemmejri commented 8 months ago
    #8 exporting to image
    18:57:33 #8 exporting layers
    18:57:36 #8 exporting layers 2.3s done
    18:57:36 #8 exporting manifest sha256:4077706c3e238b3b2911283ab9591797e147e4c4257645f972d980eab48c1615
    18:57:36 #8 exporting manifest sha256:4077706c3e238b3b2911283ab9591797e147e4c4257645f972d980eab48c1615 done
    18:57:36 #8 exporting config sha256:8b0b52b32ac33d6d0bcb8830467955d701bf237c1b8c690ec097913e85e9649f done
    18:57:36 #8 exporting attestation manifest sha256:a0a1d23dadbb60394b2aef24bac63e893411d63bcda427df9307eed7efcd9dfe 0.0s done
    18:57:36 #8 exporting manifest list sha256:aacbcaec8f00e56bfe8d5da38e3bfb69060227326779d082910ac0e017dcdb02 done
    18:57:36 #8 pushing layers 0.0s done
    18:57:36 #8 ERROR: failed to push 192.168.100.26:6610/hichemmejri/tp_foyer/hech:latest: failed to do request: Head "https://192.168.100.26:6610/v2/hichemmejri/tp_foyer/hech/blobs/sha256:7401193c4a8b69f7293fd9d6456f680a9a560f3b043a26e4a8ce476e731bd9bb": http: server gave HTTP response to HTTPS client
    18:57:36 ------
    18:57:36  > exporting to image:
    18:57:36 ------
    18:57:36 ERROR: failed to solve: failed to push 192.168.100.26:6610/hichemmejri/tp_foyer/hech:latest: failed to do request: Head "https://192.168.100.26:6610/v2/hichemmejri/tp_foyer/hech/blobs/sha256:7401193c4a8b69f7293fd9d6456f680a9a560f3b043a26e4a8ce476e731bd9bb": http: server gave HTTP response to HTTPS client
    18:57:36 Command execution failed (command: docker buildx build --builder onedev --pull . --push -t 192.168.100.26:6610/hichemmejri/tp_foyer/hech:latest, exit code: 1)
    18:57:38 Job finished
    

    always failed with same error , evec when i did all the tutorial and start a new container with option -v , there's an other solution ?

  • Robin Shen commented 8 months ago

    Please run below command manually in your terminal from the machine where you are running the build/push image step (make sure to login as the OS user running OneDev container):

    cd /path/to/your/repo
    docker buildx build --builder onedev --pull . --push -t 192.168.100.26:6610/hichemmejri/tp_foyer/hech:latest
    
  • Robin Shen commented 8 months ago

    PS: Please format the log with code block, otherwise it will clutter the comment.

  • hichemmejri commented 8 months ago

    i didnt find my project on my machine where onedev server is running .

  • Robin Shen commented 8 months ago

    Please clone your project, and run the command from the directory where your Dockerfile exists.

  • Robin Shen changed state to 'Closed' 8 months ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2385
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover