「Jenkins Pipeline」- 构建Docker镜像 @20210129

问题描述

在Pipeline中,使用docker全局变量构建镜像动作,而不是通过Shell命令构建镜像。

通过该变量,可以进行镜像构建、测试、使用。

安装插件

在Jenkins中,需要安装相关的Pipeline插件以及「Docker Pipeline」插件。

安装过程略过……与普通插件安装过程无异。

相关链接

cloudbees/Docker Pipeline plugin
Docker image for Docker Pipeline demo

# 构建镜像

# 推送镜像

# 删除镜像

stage('Docker Purge') {
	steps {
		sh 'docker image prune -fa'
		deleteDir()
	}
}

# 其他方面

How-To Use third party libraries in Jenkins Pipeline

参考文献

WikiNotes/构建Docker镜像
Jenkins Building Docker Image and Sending to Registry
you-should-add-this-as-last-stage-or-post-task-d69fb384a361
Building your first Docker image with Jenkins 2: Guide for developer
How-To Use third party libraries in Jenkins Pipeline

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值