我写了一个 dockerfile 来使用厨师在容器内安装 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
Run Code Online (Sandbox Code Playgroud)
厨师食谱:
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' …Run Code Online (Sandbox Code Playgroud)