Search code examples
dockerkubectldocker-desktopeclipse-che

How to configure docker engine inside eclipse-che environment


I have a mac and I have installed eclipse che using chectl inside docker-desktop using command

chectl server:deploy --platform=docker-desktop --installer=helm

In order to install any plugins/apks we have to have our own recepie so I built a custom recipe using a docker file and have used image FROM docker:dind pushed it to docker hub and my devfile looks like this where amoldeshpande/custom-node-test is my docker file pushed to dockerhub

apiVersion: 1.0.0
metadata:
  name: test
components:
  - mountSources: true
    endpoints:
      - name: test
        port: 3000
    memoryLimit: 512Mi
    type: dockerimage
    alias: nodejs
    image: amoldeshpande/custom-node-test

Now when I run docker command inside eclipse che workspace / $ docker images Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? I get this error.

I found out that it needs privileged access so I edited the che deployment file

kubectl edit deployment che  -n eclipse-che

and

securityContext:
     privileged: true



kubectl rollout restart deployment/che -n eclipse-che

And still, I get the same error. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? Can anyone help me here?


Solution

  • The best way to use a docker inside the eclipse che env is to use buildah plugin which requires no additional setup as it does not requires any root access. In the devfile, just add this plugin

     - id: moby/buildkit/latest
       type: chePlugin
    

    And you can run all the docker commands.