构建quarkus项目并将其码头化时发生Gitlab管道错误



我在gitlab中编写了一个简单的管道来构建一个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 -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

当管道运行时,它在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.

有什么帮助吗?

感谢

我试过很多次用docker做这件事,但都一团糟(因为docker在docker中(。我相信你也有同样的问题,因为你的错误声明No docker binary found

我的解决方案会更简单,试试Jib。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

我现在正在为多个项目使用它,它运行得很好。

作为参考,您可以在这里找到每个Jib参数Quarkus Jib

相关内容

  • 没有找到相关文章

最新更新