如何使用 jenkins x 构建 docker 图像

how to build docker image using jenkins x

我正在尝试使用 jenkins x 构建 docker 映像,并且我已经使用 minikube 创建了 kubernetes 集群。遇到错误 /var/jenkins_home/workspace/sarika-ps_go-k8s_master@tmp/durable-6564436e/script.sh: docker: not found。我已经在 jenkins x 上安装了 docker 插件。请帮我。 谢谢

您要构建什么样的项目?如果您尝试 import 您的代码,您会发现您的项目设置正确。

基本上,Jenkins X 使用构建 pods 到 运行 管道,这些管道已经在构建 pod 中拥有管道所需的所有软件工具(docker、skaffold、kubectl 等)被定义为 docker 图像。

尝试重用现有构建之一 pods - 例如使用 jenkins-maven 作为构建代理:

 pipeline {
  agent {
    label "jenkins-maven"
  }
  stages {
    stage('release') {
      steps {
        container('maven') {
          sh "docker build -t foo:bar ."
...

或者您可以尝试 create a custom build pod