Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Snippets
  • Sign up now
  • Login
  • Sign in / Register
  • C code-server-buildtools
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • Mike Terhar
  • code-server-buildtools
  • Merge requests
  • !1

WIP: Add docker building and running to the kubernetes deployment

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Mike Terhar requested to merge kube-add-docker into kubernetes Jul 05, 2020
  • Overview 0
  • Commits 0
  • Pipelines 1
  • Changes 0

The easy way to do this is to enable privileged mode and mount the docker socket into the container.

I am not going to do this so that we can keep the container unprivileged.

The VS Code extension that enables the docker workflow: https://github.com/microsoft/vscode-docker

Maybe running a dind container as a side car?

spec:
  template:
    metadata:
      labels:
        identifier: ''
    spec:
      restartPolicy: Never
      containers:
        - name: code-server
          [...]
            env:
            - name: DOCKER_HOST
              value: tcp://localhost:2375
        - name: dind-daemon
          image: docker:stable-dind
          env:
            - name: DOCKER_TLS_CERTDIR
              value: ""
          resources:
            requests:
              cpu: 20m
              memory: 512Mi
          securityContext:
            privileged: true
          volumeMounts:
            - name: docker-graph-store
              mountPath: /var/lib/docker
      volumes:
        - name: docker-graph-store
          emptyDir: {}

The big complication here is that if the docker sidecar spins up a new container, Kubelet will see it and try to murder it.... and if the pod gets re-scheduled, it could forget about the running container and we will end up with lots of other crap clogging up the node.

Edited Jul 05, 2020 by Mike Terhar
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: kube-add-docker