LoginSignup
2
3

More than 5 years have passed since last update.

ContOS7にyumでjenkinsを入れるDockerfile [追記:privileged無し]

Last updated at Posted at 2018-03-10

■環境


Windows10 Pro 1709
Docker-toolbox 18.02.0-ce
VirtualBox 5.2.8


■イメージ作成


必要最低限の物だけ記載してます。

Dockerfile
FROM centos:7.4.1708

RUN ln -sf /usr/share/zoneinfo/Japan /etc/localtime && \
    yum -y install wget && \
    wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo && \
    rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key && \
    yum -y install jenkins java-1.8.0-openjdk initscripts && \
    systemctl enable jenkins
CMD /sbin/init

ビルド

$ build -t jenkins .

■コンテナ起動


$ docker run -itd --privileged -p 8080:8080 --name my-jenkins jenkins

この画面みるまで遠かった "Orz

jenkins.jpg


■ 追記:2018.05.23 (privileged 無し版)

Dockerfile
FROM centos:7.4.1708

RUN ln -sf /usr/share/zoneinfo/Japan /etc/localtime && \
    yum -y install wget && \
    wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo && \
    rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key && \
    yum -y install jenkins java-1.8.0-openjdk initscripts

CMD ["/usr/bin/java","-jar","/usr/lib/jenkins/jenkins.war"]

$ docker run -itd -p 8080:8080 --name my-jenkins jenkins

感謝記事:お前らのdocker記事はもう古い!

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3