【发布时间】:2016-10-06 20:53:46
【问题描述】:
我写了一个 dockerfile 来使用 chef 在容器中安装 jenkins。
我已成功安装,但 jenkins 没有自动启动。我在 dockerfile 中实现了 CMD 命令,但做不到。
我关注了几篇关于此的文章,但在我的情况下不起作用
码头文件:
FROM centos:6
RUN yum -y update
RUN yum -y install wget
RUN yum -y install httpd
RUN wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins- ci.org/redhat/jenkins.repo
RUN rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
RUN yum -y install java
RUN yum -y install jenkins
CMD service jenkins start && tail -F /var/log/jenkins/jenkins.log
主厨食谱:
include_recipe 'docker'
docker_node_data = '/tmp/docker1'
directory docker_node_data do
action :create
end
cookbook_file "#{docker_node_data}/Dockerfile" do
source 'Dockerfile'
end
docker_image 'jenkins7' do
tag 'latest'
source docker_node_data
action :build
end
docker_container 'jenkins7' do
detach true
command 'top -b -d 5'
port '8080:8080'
action :run
end
【问题讨论】:
-
不确定这是否有帮助...nickhudacin.wordpress.com/2016/09/21/…
标签: jenkins docker chef-infra