【发布时间】:2019-03-04 14:49:33
【问题描述】:
我让 Jenkins 在 EC2 实例上运行。我在 Peered VPC 中配置了 EC2 插件,当一个作业被标记为“support_ubuntu_docker”时,它会启动一个 Jenkins 从站,并预先安装 Docker。
我能够按照示例进行操作,并让我的工作连接到在 Slave 上运行的本地 docker,并在容器内运行命令。
工作:https://pastebin.com/UANvjhnA
pipeline {
agent {
docker {
image 'node:7-alpine'
label 'support_ubuntu_docker'
}
}
stages {
stage('Test') {
steps {
sh 'node --version'
}
}
}
}
不工作https://pastebin.com/MsSZaPha
pipeline {
agent {
docker {
image 'hashicorp/terraform:light'
label 'support_ubuntu_docker'
}
}
stages {
stage('Test') {
steps {
sh 'terraform --version'
}
}
}
}
我已尝试使用 ansible/ansible:default 图像,以及我自己创建的图像。
FROM alpine:3.7
RUN apk add --no-cache terraform
RUN apk add --no-cache ansible
ENTRYPOINT ["/bin/ash"]
此图像在本地运行。
[jenkins_test] docker exec -it 3843653932c8 ash 10:56:42 ☁ master ☂ ⚡ ✭
/ # terraform --version
Terraform v0.11.0
/ # ansible --version
ansible 2.4.6.0
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15 (default, Aug 22 2018, 13:24:18) [GCC 6.4.0]
/ #
我真的只想能够克隆我的 terraform git repo,并使用容器中的 terraform 来运行我的 init/plan/applies。
我遇到的所有这些错误是。
java.io.IOException: Failed to run top 'c9dfeda21b718b9df1035500adf2ef80c5c3807cf63e724317d620d4bcaa14b3'. Error: Error response from daemon: Container c9dfeda21b718b9df1035500adf2ef80c5c3807cf63e724317d620d4bcaa14b3 is not running
【问题讨论】:
标签: docker jenkins amazon-ec2