下面是运行中运行码头工人一詹金斯容器中的文件:
码头 - 撰写。阳明海运
jenkins:
build: .
restart: always
ports:
- "8080:8080"
- "5000:5000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Dockerfile
FROM jenkins/jenkins:2.73.2
# install docker, docker-compose, docker-machine
# see: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
# see: https://docs.docker.com/engine/installation/linux/linux-postinstall/
# see: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
USER root
# prerequisites for docker
RUN apt-get update \
&& apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
# docker repos
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" >> /etc/apt/sources.list.d/additional-repositories.list \
&& echo "deb http://ftp-stud.hs-esslingen.de/ubuntu xenial main restricted universe multiverse" >> /etc/apt/sources.list.d/official-package-repositories.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 437D05B5 \
&& apt-get update
# docker
RUN apt-get -y install docker-ce
# docker-compose
RUN curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
# give jenkins docker rights
RUN usermod -aG docker jenkins
USER jenkins
我能够使用泊坞窗通过运行shell脚本撰写,我不知道,如果它可以在管道中使用,但如果你可以运行shell在管道中的脚本,那么它不应该是一个问题。 –
不幸的是,我终于来到了一个解决方案,其中包括从'sh'步骤运行'docker compose',将其嵌入'try ... finally'子句中进行生命周期控制。 **目前,Jenkins插件生态系统**不支持'docker-compose'。不过,我会密切关注官方[CloudBees Docker管道插件](https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Pipeline+Plugin),而不是实验[Docker Slaves Plugin]( https://wiki.jenkins-ci.org/display/JENKINS/Docker+Slaves+Plugin)。 – luka5z