【问题标题】:jenkins pipeline don't pull image in dockerhubjenkins 管道不会在 dockerhub 中提取图像
【发布时间】:2021-10-04 11:39:51
【问题描述】:

jenkins 没有拉取图像。我正在使用窗户。我将詹金斯作为容器运行。我收到以下错误。如果你能帮助我,我会很高兴。

    node {
    def commit_id
    stage('Preparation') {
    checkout scm
    sh "git rev-parse --short HEAD > .git/commit_id"
    commit_id = readFile('.git/commit_id').trim()
    }

    stage('test') {
    def myTestContainer = docker.image('node:4.6')
    myTestContainer.pull()
    myTestContainer.inside {
    sh ' npm install --only=dev '
    sh ' npm '

    }}}

enter image description here

【问题讨论】:

    标签: docker jenkins jenkins-pipeline dockerhub linux-containers


    【解决方案1】:

    试试这个:

    pipeline {
        agent {
            docker {
                image 'node:4.6'
                label 'agent-name'
            }
        }
    
        stages {
            stage('test') {
                // your code here
            }
        }
    }
    

    agent-name替换为从代理名称或master作为容器的主机。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-08
      • 2022-10-19
      • 1970-01-01
      • 1970-01-01
      • 2022-01-16
      • 2021-12-03
      • 1970-01-01
      • 2016-10-02
      相关资源
      最近更新 更多