Gitlab-CI docker-maven-plugin 打包
- 必备条件
需要开启宿主机docker的2375端口#编辑docker.service vi /usr/lib/systemd/system/docker.service #在execstart属性上新增属性 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 #重载 daemon systemctl daemon-reload #重启doker systemctl restart docker
2.编写gitlab-ci文件指定Docker-host
stages:
- package
job_docker_package:
stage: package
image: maven:3.6.3-jdk8
variables:
DOCKER_HOST: tcp://172.17.0.1:2375
script:
- mvn clean package -DskipTests
- mvn docker:build docker:push dock