Docker Plugin for Jenkins error: Scripts not permitted to use method

别等时光非礼了梦想. 提交于 2019-12-05 14:42:34

I was able to get around this by installing docker-io on my slave from this Docker image and using a separate Docker host that could service the calls I needed to make to build, run and push my docker image to my registry.

I ended up using the following script to resolve this:

docker.withServer(DOCKER_MACHINE_HOSTNAME) {
    def image = docker.build(DOCKER_TAG, '.')

    // Test container then stop and remove it
    def container = image.run('--name ' + DOCKER_CONTAINER_NAME)
    container.stop()

    docker.withRegistry(DOCKER_REGISTRY, QUAY_CREDENTIALS_ID ) {
        image.push(DOCKER_APPLICATION_TAG)
    }
}

Maybe it's related to this issue: https://issues.jenkins-ci.org/browse/JENKINS-30414

As explained in the latest comment, The Script Security plugin can be the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!