fix(jenkins): Add Docker CLI via init container and mount docker socket
This commit is contained in:
@@ -15,6 +15,18 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
|
initContainers:
|
||||||
|
- name: install-docker-cli
|
||||||
|
image: docker:24-cli
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
cp /usr/local/bin/docker /tmp/docker-bin/
|
||||||
|
chmod +x /tmp/docker-bin/docker
|
||||||
|
volumeMounts:
|
||||||
|
- name: docker-cli
|
||||||
|
mountPath: /tmp/docker-bin
|
||||||
containers:
|
containers:
|
||||||
- name: jenkins
|
- name: jenkins
|
||||||
image: jenkins/jenkins:lts-jdk17
|
image: jenkins/jenkins:lts-jdk17
|
||||||
@@ -24,11 +36,15 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: JENKINS_OPTS
|
- name: JENKINS_OPTS
|
||||||
value: "--httpPort=8080"
|
value: "--httpPort=8080"
|
||||||
|
- name: PATH
|
||||||
|
value: "/tmp/docker-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: jenkins-home
|
- name: jenkins-home
|
||||||
mountPath: /var/jenkins_home
|
mountPath: /var/jenkins_home
|
||||||
- name: docker-sock
|
- name: docker-sock
|
||||||
mountPath: /var/run/docker.sock
|
mountPath: /var/run/docker.sock
|
||||||
|
- name: docker-cli
|
||||||
|
mountPath: /tmp/docker-bin
|
||||||
volumes:
|
volumes:
|
||||||
- name: jenkins-home
|
- name: jenkins-home
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
@@ -37,3 +53,5 @@ spec:
|
|||||||
hostPath:
|
hostPath:
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
type: Socket
|
type: Socket
|
||||||
|
- name: docker-cli
|
||||||
|
emptyDir: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user