プラグインインストール済のJenkins 構築 Docker編 番外編

##環境や前提条件
windows10 pro 1803
PowerShell
Docker 18.09.0
jenkins:2.19.4

##モチベーション
jenkinsのImageをpullしてくると、そのベースになっているlinuxのことを全く意識しなくてよいのだが、気になったので調べてみた。

コンテナにログイン

```
PS C:\docker\jenkins> docker exec -i -t myjenkins-3 bash
```

ディストリビューション名の確認→Debian 8ということがわかる。

```
jenkins@df7311076006:/$ cat /etc/issue
Debian GNU/Linux 8 \n \l
```

Debianのバージョンは8.6

```
jenkins@df7311076006:/etc$ cat /etc/debian_version
8.6
```

unameでバージョン確認

```
jenkins@df7311076006:/$ uname -a
Linux df7311076006 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 GNU/Linux
```
意味は以下の通り。

- Linux：OS名
- df7311076006：ノード名
- 4.9.125-linuxkit：OSのリリース
- #1 SMP Fri Sep 7 08:20:28 UTC 2018：OSのバージョン 
- x86_64：マシンおよびハードウェアの名称
- GNU/Linux

docker historyでImageがどのように作られたかの履歴を確認。

```
PS C:\docker\jenkins> docker history --no-trunc myjenkins:1
IMAGE                                                                     CREATED             CREATED BY                                                                                                                                                                                                                                                                                                                                                           SIZE                COMMENT
sha256:f61635651954adb853e95690b04dd3791e4fdbcfab7bfb66a2d505e31f3df31c   2 years ago         /bin/sh -c #(nop) COPY file:2a6a3e16202b8dddab5edef50f712c16fe8f6980f5aea80c8c76b5db4f903913 in /usr/local/bin/install-plugins.sh                                                                                                                                                                                                                                    5.96kB
<missing>                                                                 2 years ago         /bin/sh -c #(nop) COPY file:93fb511d485dd2d6060c484dcedb902947875042048de529676a0a0aed27b5a3 in /usr/local/bin/plugins.sh                                                                                                                                                                                                                                            3.92kB
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENTRYPOINT ["/bin/tini" "--" "/usr/local/bin/jenkins.sh"]                                                                                                                                                                                                                                                                                         0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop) COPY file:7eec179a0dd3aad4a9c9290bc4d85e4775c8cf6bc2932527892ca6e87739e474 in /usr/local/bin/jenkins.sh                                                                                                                                                                                                                                            1.21kB
<missing>                                                                 2 years ago         /bin/sh -c #(nop) COPY file:26c3c5818bc87662d1f4905a3ed73bd55a0a75f731c7dc52d0599c00f51408e9 in /usr/local/bin/jenkins-support                                                                                                                                                                                                                                       5kB
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  USER [jenkins]                                                                                                                                                                                                                                                                                                                                    0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log                                                                                                                                                                                                                                                                             0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  EXPOSE 50000/tcp                                                                                                                                                                                                                                                                                                                                  0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  EXPOSE 8080/tcp                                                                                                                                                                                                                                                                                                                                   0B
<missing>                                                                 2 years ago         |6 JENKINS_SHA=ea61a4ff86f0db715511d1118a4e2f0a6a0311a1 JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/2.19.4/jenkins-war-2.19.4.war gid=1000 group=jenkins uid=1000 user=jenkins /bin/sh -c chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref                                                                                 328B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV JENKINS_UC=https://updates.jenkins.io                                                                                                                                                                                                                                                                                                         0B
<missing>                                                                 2 years ago         |6 JENKINS_SHA=ea61a4ff86f0db715511d1118a4e2f0a6a0311a1 JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/2.19.4/jenkins-war-2.19.4.war gid=1000 group=jenkins uid=1000 user=jenkins /bin/sh -c curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war   && echo "${JENKINS_SHA}  /usr/share/jenkins/jenkins.war" | sha1sum -c -   69.8MB
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/2.19.4/jenkins-war-2.19.4.war                                                                                                                                                                                                                                  0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ARG JENKINS_SHA=ea61a4ff86f0db715511d1118a4e2f0a6a0311a1                                                                                                                                                                                                                                                                                          0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV JENKINS_VERSION=2.19.4                                                                                                                                                                                                                                                                                                                        0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ARG JENKINS_VERSION                                                                                                                                                                                                                                                                                                                               0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop) COPY file:c629bc0b9ecb5b7233000c973f65721df4ce1307a5d5b33ac3871ff61a9172ff in /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy                                                                                                                                                                                                     328B
<missing>                                                                 2 years ago         |4 gid=1000 group=jenkins uid=1000 user=jenkins /bin/sh -c curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static -o /bin/tini && chmod +x /bin/tini   && echo "$TINI_SHA  /bin/tini" | sha1sum -c -                                                                                                                              823kB
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV TINI_SHA=fa23d1e20732501c3bb8eeeca423c89ac80ed452                                                                                                                                                                                                                                                                                             0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV TINI_VERSION=0.9.0                                                                                                                                                                                                                                                                                                                            0B
<missing>                                                                 2 years ago         |4 gid=1000 group=jenkins uid=1000 user=jenkins /bin/sh -c mkdir -p /usr/share/jenkins/ref/init.groovy.d                                                                                                                                                                                                                                                             0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  VOLUME [/var/jenkins_home]                                                                                                                                                                                                                                                                                                                        0B
<missing>                                                                 2 years ago         |4 gid=1000 group=jenkins uid=1000 user=jenkins /bin/sh -c groupadd -g ${gid} ${group}     && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}                                                                                                                                                                                                 335kB
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ARG gid=1000                                                                                                                                                                                                                                                                                                                                      0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ARG uid=1000                                                                                                                                                                                                                                                                                                                                      0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ARG group=jenkins                                                                                                                                                                                                                                                                                                                                 0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ARG user=jenkins                                                                                                                                                                                                                                                                                                                                  0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV JENKINS_SLAVE_AGENT_PORT=50000                                                                                                                                                                                                                                                                                                                0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV JENKINS_HOME=/var/jenkins_home                                                                                                                                                                                                                                                                                                                0B
<missing>                                                                 2 years ago         /bin/sh -c apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*                                                                                                                                                                                                                                                                              0B
<missing>                                                                 2 years ago         /bin/sh -c /var/lib/dpkg/info/ca-certificates-java.postinst configure                                                                                                                                                                                                                                                                                                418kB
<missing>                                                                 2 years ago         /bin/sh -c set -x  && apt-get update  && apt-get install -y   openjdk-8-jdk="$JAVA_DEBIAN_VERSION"   ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION"  && rm -rf /var/lib/apt/lists/*  && [ "$JAVA_HOME" = "$(docker-java-home)" ]                                                                                                                               352MB
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV CA_CERTIFICATES_JAVA_VERSION=20140324                                                                                                                                                                                                                                                                                                         0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV JAVA_DEBIAN_VERSION=8u111-b14-2~bpo8+1                                                                                                                                                                                                                                                                                                        0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV JAVA_VERSION=8u111                                                                                                                                                                                                                                                                                                                            0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64                                                                                                                                                                                                                                                                                                   0B
<missing>                                                                 2 years ago         /bin/sh -c {   echo '#!/bin/sh';   echo 'set -e';   echo;   echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"';  } > /usr/local/bin/docker-java-home  && chmod +x /usr/local/bin/docker-java-home                                                                                                                                           87B
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  ENV LANG=C.UTF-8                                                                                                                                                                                                                                                                                                                                  0B
<missing>                                                                 2 years ago         /bin/sh -c echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list                                                                                                                                                                                                                                             55B
<missing>                                                                 2 years ago         /bin/sh -c apt-get update && apt-get install -y --no-install-recommends   bzip2   unzip   xz-utils  && rm -rf /var/lib/apt/lists/*                                                                                                                                                                                                                                   1.29MB
<missing>                                                                 2 years ago         /bin/sh -c apt-get update && apt-get install -y --no-install-recommends   bzr   git   mercurial   openssh-client   subversion     procps  && rm -rf /var/lib/apt/lists/*                                                                                                                                                                                             123MB
<missing>                                                                 2 years ago         /bin/sh -c apt-get update && apt-get install -y --no-install-recommends   ca-certificates   curl   wget  && rm -rf /var/lib/apt/lists/*                                                                                                                                                                                                                              44.3MB
<missing>                                                                 2 years ago         /bin/sh -c #(nop)  CMD ["/bin/bash"]                                                                                                                                                                                                                                                                                                                                 0B
<missing>                                                                 2 years ago         /bin/sh -c #(nop) ADD file:1d214d2782eaccc743b8d683ccecf2f87f12a0ecdfbcd6fdf4943ce616f23870 in /                                                                                                                                                                                                                                                                     123MB
```
javaがopenjdk8.111
JENKINS_HOME=/var/jenkins_home  
JENKINS_VERSION=2.19.4  
などの設定をしていることがわかる。

以上、興味本位で調べてみた。番外編でした。