我正在使用构建工作的Docker从属设备。 Jenkins主服务器通过SSH连接到动态docker从服务器以复制远程代理。以下是我的Jenkins配置。
Jenkins Docker plugin configuration
“注入SSH密钥”选项如何工作?在下面的句子中,詹金斯大师的独特身份是什么意思?
“将将专用的SSH密钥(基于Jenkins master的唯一身份)注入到容器中,并按相应方式配置sshd”
用于创建docker从属映像的Dockerfile:
FROM centos:latest
MAINTAINER ben5556
# Install a basic SSH server GIT, UNZIP and JDK 8
RUN yum install -y openssh-server git unzip java-1.8.0-openjdk-headless && yum clean all
# update sshd settings, create jenkins user, set jenkins user pw, generate ssh keys
RUN sed -i 's|session required pam_loginuid.so|session optional pam_loginuid.so|g' /etc/pam.d/sshd \
&& mkdir -p /var/run/sshd \
&& useradd -u 1000 -m -s /bin/bash jenkins \
&& echo "jenkins:<password>" | chpasswd \
&& /usr/bin/ssh-keygen -A \
&& echo export JAVA_HOME="/`alternatives --display java | grep best | cut -d "/" -f 2-6`" >> /etc/environment
# Set java environment
ENV JAVA_HOME /etc/alternatives/jre
# Copy & Install maven
COPY apache-maven-3.5.4-bin.zip /opt/
WORKDIR /opt
RUN unzip apache-maven-3.5.4-bin.zip
# Append PATH env with Maven location
ENV PATH="/opt/apache-maven-3.5.4/bin:${PATH}"
# Standard SSH port
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]