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