我有在EC2机器上运行的jenkins作业,我想将所有作业迁移到Docker容器中 [英] I have jenkins jobs running on ec2 machine i want to migrate all the jobs in to docker container
问题描述
我有jenkins作业在ec2机器上运行。如何将所有作业迁移到Docker容器中?
I have jenkins jobs running on ec2 machine. how to migrate all the jobs in to docker container?
推荐答案
您可以装载整个 $ JENKINS_HOME
从您的ec2实例到容器的 $ JENKINS_HOME
(或仅某些目录,例如 $ JENKINS_HOME / jobs
到容器 $ JENKINS_HOME / jobs
目录)。
You can mount the entire $JENKINS_HOME
from your ec2 instance to the $JENKINS_HOME
of the container (or just certain directories, e.g. $JENKINS_HOME/jobs
to the containers $JENKINS_HOME/jobs
directory).
使用 docker -撰写
,并假设 $ {PWD} / ec2
包含 $ JENKINS_HOME
的副本从我的ec2实例中获取:
Using docker-compose
and assuming ${PWD}/ec2
contains a copy of the $JENKINS_HOME
from my ec2 instance:
version: '3'
services:
filtering:
image: jenkins/jenkins:lts
ports:
- "8080:8080"
volumes:
- ${PWD}/ec2:/var/jenkins_home
仅使用 docker
: docker run- v $ {PWD} / ec2:/ var / jenkins_home -p 8080:8080 jenkins / jenkins:lts
注意:安装整个 $ JENKINS_HOME
的优点是可以保持certai n配置位于 $ JENKINS_HOME / jobs
目录之外,例如 $ JENKINS_HOME / nodes
。
Note: mounting the entire $JENKINS_HOME
has the advantage of keeping certain config that resides outside of the $JENKINS_HOME/jobs
directory such as the $JENKINS_HOME/nodes
.
这篇关于我有在EC2机器上运行的jenkins作业,我想将所有作业迁移到Docker容器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!