Skip to content

Docker In Docker for code-server #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Rakiah opened this issue Mar 11, 2019 · 19 comments · Fixed by #5045
Closed

Docker In Docker for code-server #199

Rakiah opened this issue Mar 11, 2019 · 19 comments · Fixed by #5045

Comments

@Rakiah
Copy link

Rakiah commented Mar 11, 2019

I've been trying to fiddle with the Dockerfile of code-server to add support for Docker in Docker but without success, I tried numerous ubuntu images but then code-server will have problem running:

those are the ones I tested:
https://hub.docker.com/r/billyteves/ubuntu-dind
https://hub.docker.com/r/jazzypro/ubuntu-dind
https://hub.docker.com/r/ciiichy/ubuntu-dind-git
https://hub.docker.com/r/ceregousa/dind
https://hub.docker.com/r/huksley/ubuntu-dind/dockerfile

most of the times i'm getting

{"data":"Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /root/project/.local/share/code-server/dependencies/spdlog.node)\n    at Object.Module._extensions..node (module.js:682:18)\n    at Module.load (module.js:566:32)\n    at tryModuleLoad (module.js:506:12)\n    at Function.Module._load (module.js:498:3)\n    at Module.require (module.js:597:17)\n    at Module.patchedRequire [as require] (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:6615:46)\n    at require (internal/module.js:11:18)\n    at f (/usr/local/bin/code-server:2281:1092)\n    at u (/usr/local/bin/code-server:2281:1344)\n    at c (/usr/local/bin/code-server:2281:2750)\n    at b.require (/usr/local/bin/code-server:2281:3346)\n    at Object../lib/vscode/node_modules/spdlog/index.js (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:28679:16)\n    at __webpack_require__ (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:26:30)\n    at Object.createSpdLogService (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:157268:29)\n    at main (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:77357:92)\n    at eval (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:77449:13)\n    at Generator.next (<anonymous>)\n    at fulfilled (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:77333:58)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)\n"}
code-server_1     | INFO  Retrying shared process in 8s {"error":"Exited with null"}

when code-server is trying to boot up, do you have any idea to do what i'm trying to achieve ?

@PhilsLab
Copy link

See #190

@Rakiah
Copy link
Author

Rakiah commented Mar 11, 2019

To be honest i didn't really understood how to apply #190 to my problem ?

@jeasonstudio
Copy link
Contributor

@Rakiah see #23 (comment)

@sr229
Copy link
Contributor

sr229 commented Mar 12, 2019

Hey @Rakiah, here's an idea from me:

  • use the DIND image from PWD (they have a Ubuntu version)
  • install the required dependencies (net-tools)
  • Pull code-server from releases.

@Rakiah
Copy link
Author

Rakiah commented Mar 12, 2019

OK I see that #190 would sove it using Kubernetes
sadly we don't use kubernetes at work and I dont have a PHD in kubernetology :(

I've been trying to find an image called DIND under PWD in hub.docker.com but didn't find anything, can you provide a link for that please @sr229
thanks for your help

@Rakiah
Copy link
Author

Rakiah commented Mar 12, 2019

EDIT:

I think I found the DIND image you're speaking about:
https://hub.docker.com/r/franela/dind/tags

I'll check and update my results

@Rakiah
Copy link
Author

Rakiah commented Mar 12, 2019

seems like 18.09 ubuntu is not enough neither:
``` ERROR SHARED stderr {"data":"Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /root/project/.local/share/code-server/dependencies/spdlog.node

got the same error

@StiviiK
Copy link

StiviiK commented Mar 12, 2019

You could also use the docker:dind as a side-car.
Install docker normally in the code-server image, create a docker:dind container and link it to the code-server-container, you should be able to use docker in code-server.

Update, tested works:
image

@Rakiah
Copy link
Author

Rakiah commented Mar 12, 2019

Stivik, may you provide steps for this ?
How would I link the docker:dind container to code-server ?

@arukaen
Copy link

arukaen commented Mar 12, 2019

Stivik, may you provide steps for this ?
How would I link the docker:dind container to code-server ?

https://docs.docker.com/network/links/

@Rakiah
Copy link
Author

Rakiah commented Mar 15, 2019

Ok that's also what I tought but I may misunderstood the points of docker link because I didnt think that would work, will try !

@sr229
Copy link
Contributor

sr229 commented Mar 15, 2019

@arukaen I don't recommend suggesting deprecated Docker APIs and CLI commands to solve a solution.

@Rakiah While this might be a temporary solution, keep in mind Docker links are deprecated.

@Rakiah
Copy link
Author

Rakiah commented Mar 15, 2019

Docker link itself was not enough:
i've created a network between the two container, installed docker-cli in the code-server container and exported the docker host like this in the code-server container:
export DOCKER_HOST="tcp://dind:2375"
(dind is the docker in docker container)

this seems to work for my needs

@kylecarbs
Copy link
Member

Seems like this might not be a docker-in-docker issue and a GLIBC issue. We lowered the GLIBC requirement a while back, could you try again?

@Rakiah
Copy link
Author

Rakiah commented Apr 27, 2019

I found my answer during this thread and do not have the problem anymore thank you @kylecarbs we can close this

@sr229
Copy link
Contributor

sr229 commented Apr 27, 2019

CC @kylecarbs or @coadler to close the issue as per request by the author

@matthew-parlette
Copy link

In case anyone is looking to do this with kubernetes, here is my deployment I'm using that has this working as far as I've tested:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: code-server
  namespace: default
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: code-server
    spec:
      initContainers:
      - name: copy-docker-binary
        image: docker:stable-dind
        command: ['sh', '-c', 'cp /usr/local/bin/docker /code-server-bin/']
        volumeMounts:
        - name: code-server-usr-local-bin
          mountPath: /code-server-bin
      containers:
      - name: code-server
        image: linuxserver/code-server
        imagePullPolicy: Always
        ports:
        - containerPort: 8443
          name: https
        envFrom:
        - configMapRef:
            name: code-server
        - secretRef:
            name: code-server
        volumeMounts:
        - name: config
          mountPath: /config
          readOnly: false
        - name: code-server-usr-local-bin
          mountPath: /usr/local/bin
      - 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-storage
            mountPath: /var/lib/docker
      volumes:
      - name: config
        persistentVolumeClaim:
          claimName: code-server-config
      - name: docker-graph-storage
        emptyDir: {}
      - name: code-server-usr-local-bin
        emptyDir: {}

Let me know if you need my other resources for this, but I believe everything for this issue is covered in this deployment.

@sr229
Copy link
Contributor

sr229 commented Aug 16, 2019

Would appreciate if you can do a documentation PR for this as well since people might want to run Docker development in Docker-based code-server.

@jon-peel
Copy link

@Rakiah, hello.

Did you manage to get a docker in docker working with code-server?
Do you mind sharing how you did it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants