Skip to content

Instantly share code, notes, and snippets.

@yuvipanda
Last active Feb 3, 2022
Embed
What would you like to do?
Remote docker builder with kubernetes
# Once started, you can use this to build your docker images with:
#
# kubectl -n <namespace> port-forward deployment/dind 23760:2376
# export DOCKER_HOST=tcp://localhost:23760
#
# After that, all docker commands & similar will talk to this docker instance on kubernetes!
apiVersion: apps/v1
kind: Deployment
metadata:
name: dind
labels:
app: dind
spec:
selector:
matchLabels:
app: dind
replicas: 1
template:
metadata:
labels:
app: dind
spec:
volumes:
- name: var-lib-docker
persistentVolumeClaim:
claimName: dind
containers:
- name: docker
image: docker:20.10.2-dind
command:
- dockerd
- --host=127.0.0.1:2376
volumeMounts:
- name: var-lib-docker
mountPath: /var/lib/docker
securityContext:
privileged: true
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dind
labels:
app: dind
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 400Gi
storageClassName: ssd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment