Skip to content

Instantly share code, notes, and snippets.

@yuvipanda
Last active September 15, 2022 03:48
Show Gist options
  • Save yuvipanda/48100eb9e15dae808052c7dc9fb22edb to your computer and use it in GitHub Desktop.
Save yuvipanda/48100eb9e15dae808052c7dc9fb22edb to your computer and use it in GitHub Desktop.
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.18-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: 100Gi
storageClassName: ssd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment