简体   繁体   English

Gitlab 构建 quarkus 项目并对其进行 docker 化时出现管道错误

[英]Gitlab pipeline error when building quarkus project and dockerizing it

I wrote a simple pipeline in gitlab to build a quarkus project, to dockerize it and to push the final image to a registry.我在 gitlab 中编写了一个简单的管道来构建一个 quarkus 项目,将其 docker 化并将最终图像推送到注册表。 Here it is:这里是:

image: maven:latest

stages:
  - build-package-dockerize
  - deploy

before_script:
  - apt-get update -qq
  - apt-get install -y -qq build-essential libz-dev zlib1g-dev

build, package, dockerize:
  stage: build-package-dockerize
  script:
    - mvn clean package -DskipTests -Dquarkus.profile=dev -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.container-image.group=pss -Dquarkus.container-image.tag=$CI_BUILD_REF -Dquarkus.container-image.registry=$DOCKER_REGISTRY_AZURE_URL -Dquarkus.container-image.username=$DOCKER_REGISTRY_AZURE_USERNAME -Dquarkus.container-image.password=$DOCKER_REGISTRY_AZURE_PASSWORD 
  only:
    - DEV

When the pipe runs it returns error in ryuk container deployment:当 pipe 运行时,它在 ryuk 容器部署中返回错误:

[INFO] Container testcontainers/ryuk:0.3.3 is starting: 2611772cb72f4f2437ee1c405243d7519dfe787d8a0f343b292e8b2db4aa4869
1745[ERROR] Could not start container
1746java.lang.IllegalStateException: Container is removed
[ERROR] There are no stdout/stderr logs available for the failed container
1777[WARNING] [io.quarkus.deployment.IsDockerWorking] No docker binary found or general error: java.lang.RuntimeException: Input/Output error while executing command.

Any help?有什么帮助吗?

Thanks谢谢

I tried many times doing it with docker but it was a mess (cause Docker in docker).我用 docker 尝试了很多次,但它一团糟(因为 Docker 在 docker 中)。 I believe you have the same problem because your error states that No docker binary found .我相信您有同样的问题,因为您的错误指出No docker binary found

My solution would be easier, try with Jib.我的解决方案会更容易,试试 Jib。 Quarkus supports it by default and it's much easier to use, see my example: Quarkus 默认支持它,而且它更容易使用,见我的例子:

image: maven:latest

stages:
  - build-package-dockerize
  - deploy

before_script:
  - apt-get update -qq
  - apt-get install -y -qq build-essential libz-dev zlib1g-dev

build-package-dockerize:
  stage: build-package-dockerize
  script:
    - mvn clean package
      -DskipTests
      -Dquarkus.profile=dev
# Instruct Quarkus to use Jib
      -Dquarkus.container-image.builder=jib
# Don't forget to add token file to repo, otherwise you'll get http 401 when pushing
      -Dquarkus.jib.to.auth.username=gitlab-ci-token
      -Dquarkus.jib.to.auth.password=${CI_TOKEN_PASSWORD}
      -Dquarkus.container-image.build=true
      -Dquarkus.container-image.push=true
      -Dquarkus.container-image.group=pss
      -Dquarkus.container-image.tag=$CI_BUILD_REF
      -Dquarkus.container-image.registry=$DOCKER_REGISTRY_AZURE_URL 
      -Dquarkus.container-image.username=$DOCKER_REGISTRY_AZURE_USERNAME
      -Dquarkus.container-image.password=$DOCKER_REGISTRY_AZURE_PASSWORD 
  only:
    - DEV

I'm using it right now for multiple projects, and its working perfectly.我现在将它用于多个项目,并且运行良好。

For reference, you can find every Jib params here Quarkus Jib作为参考,您可以在此处找到每个 Jib 参数Quarkus Jib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 gitlab 管道作业中使用 yq 图像时出错 - Error when using yq image in gitlab pipeline job 我的管道与我的 gitlab 项目的身份验证问题 - Authentication problem of my pipeline with my gitlab project GitLab 管道抛出 Azure CLI 错误 - GitLab Pipeline is throwing an Azure CLI error Gitlab 管道触发器在浏览器中粘贴 webhook URL 时给出 404 - Gitlab pipeline trigger gives 404 when pasting webhook URL in the browser 为什么在使用 quarkus-amazon-lambda 和 quarkus-smallrye-openapi 包时会出现错误? - Why do I get an error when using quarkus-amazon-lambda and quarkus-smallrye-openapi packages? cURL command to GitLab API in GitLab pipeline succeeds with [0 bytes data] when cURL contains variable - cURL command to GitLab API in GitLab pipeline succeeds with [0 bytes data] when cURL contains variable GitLab:将项目转移到组显示403禁止错误 - GitLab: Transferring project to Group shows 403 Forbidden error Gitlab CI管道解压问题 - Unzip problems in Gitlab CI pipeline 当我从 gitlab 克隆项目时,Xcode 显示错误代码 - Xcode shows wrong code when I clone project from gitlab 使用 Bash 和 cURL 通过 CI/CD 管道进入时生成 GitLab 合并请求 - Generate GitLab Merge Request when a push comes in via CI/CD Pipeline using Bash and cURL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM