下面是運行中運行碼頭工人一詹金斯容器中的文件:
碼頭 - 撰寫。陽明海運
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