Skip to content

Instantly share code, notes, and snippets.

@remcohendriks
Created August 29, 2020 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remcohendriks/abb6bee55952837f33debe13882b7cf2 to your computer and use it in GitHub Desktop.
Save remcohendriks/abb6bee55952837f33debe13882b7cf2 to your computer and use it in GitHub Desktop.
Docker-in-docker service for docker image layer caching with distributed Gitlab build runners.
apiVersion: apps/v1
kind: Deployment
metadata:
name: dind
namespace: gitlab-runner
spec:
selector:
matchLabels:
app: dind
strategy:
type: Recreate
template:
metadata:
labels:
app: dind
spec:
containers:
- image: docker:dind
imagePullPolicy: Always
name: dind
ports:
- containerPort: 2375
name: dind
env:
- name: DOCKER_HOST
value: tcp://localhost:2375
- name: DOCKER_TLS_CERTDIR
value: ""
securityContext:
privileged: true
volumeMounts:
- name: dind-storage
mountPath: /var/lib/docker
volumes:
- name: dind-storage
persistentVolumeClaim:
claimName: dind-pv-claim
---
apiVersion: v1
kind: Service
metadata:
name: dind
namespace: gitlab-runner
spec:
selector:
app: dind
ports:
- protocol: TCP
name: http
port: 2375
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dind-pv-claim
namespace: gitlab-runner
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 32Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment