Jenkins constructed using Docker mirror --SpringCloud

Premise significance:
SpringCloud micro service contains multiple folders, pulls warehouse all the code, and then compile the package by using maven jar according to the specified directory option parameters, and then make Docker image files in this directory according to Dockerfile

1. SpringCloud project structure

Note Dockerfile location of the file, with the same level pom.xml src and will be used later in this document, if not at the same level, select Dockerfile file back when you need to modify, as appropriate, and that is the use of environment variables in several places

Git repository is the entire project, but compiled only packaged spring-cloud-eureka-server-demo folder according to the options parameter

2. Docker Configuration

Open the Remote Access:

vim /lib/systemd/system/docker.service
# 添加下面这行
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

systemctl daemon-reload
systemctl docker restart

Configuration 163 domestic source:

vim /etc/docker/daemon.json
{
   "registry-mirrors": ["http://hub-mirror.c.163.com"]
}

3. Jenkins Configuration

Docker plug mounting
system management system settings --- --- cloud added docker configuration information, FIG follows:

Set 4. Project

Construct, after selection operation must generate jar package, detailed look screenshot:

Guess you like

Origin www.cnblogs.com/sanduzxcvbnm/p/11797660.html