当jenkins位于docker容器中时,如何在docker容器上运行构建

时间:2018-05-30 02:09:40

标签: docker jenkins continuous-integration

我在docker容器中运行了一个jenkins单实例。主机是AWS 16.04.3 LTS (Xenial Xerus)系统。我希望jenkins在docker容器中运行我的构建,但是因为jenkins已经在docker中运行了。我不希望在构建中运行嵌套的docker容器。如何让jenkins在主机上启动docker容器而不是自己的容器?

1 个答案:

答案 0 :(得分:1)

我找到了一个解决方案,就是在jenkins容器上安装这个目录:

import java.util.*;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter price: $");
float price = keyboard.nextFloat();
System.out.println("Early payment (Y/N): ");
String char1 = keyboard.nextLine();

float amount = price;

if (char1.equals('Y'))
{
  amount = price * 0.9;
}

System.out.printf("Amount due: $%0.2f\n", amount);


}
}