https://orbstack.dev logo
dind in Devcontainers
# support
n
Hello, I am trying to migrate out of Docker Desktop to OrbStack however dind in Devcontainers isn't working
Copy code
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Anyone knows if it's possible with OrbStack? Thanks
r
docker context use orbstack
woudl be the first thing I'd do
n
Thanks for the reply, works fine on the host, but not in the devcontainer (VS Code) where I try to run dind in:
Copy code
docker context use orbstack
context "orbstack": context not found: open /home/node/.docker/contexts/meta/2d89b732b01a00a2d1675ed3cee9fd0f965daadf90603c989dd3afd4569c6896/meta.json: no such file or directory
My devcontainer:
Copy code
"runArgs": [
    "--cap-add=NET_ADMIN",
    "--cap-add=NET_RAW"
  ],
....
   "features":{
        "ghcr.io/devcontainers/features/docker-in-docker:2": {
            "moby": "false"
        },
    },
....
What I see inside the container running through OrbStack:
Copy code
docker context ls
NAME        DESCRIPTION                               DOCKER ENDPOINT               ERROR
default *   Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
r
I don't know enough about dind to continue, but remembrer you're running docker inside... it's not about orbstack, is it?
n
Yeah sort of, thanks for the help anyways, will dig further to see if I can find why It just works out of the box when using Docker Desktop on the host, but not when using Orbstack
r
I'll be interested in what you learn.
Feels bit of a hack but somehow works fine (for the time being)
r
Seems like you're not actually doing DinD then, true? Now you're using the external docker?
n
I think docker in docker does the same because when I use this in Docker Desktop, I can see the internal containers running in main Docker Desktop as well
r
Hmm, I don't think that's true. DinD runs dockerd inside the container, as far as I understand. That said... you may not be interested in DinD in this situation, just want some docker to work with your devcontainer.
n
Just went the wrong direction
Yeah I think you're right
r
Ah, I guess both ways may be referred to as DinD...
I guess yours is "Docker-from-Docker", and it's legit
ChatGPT says "In modern CI/CD pipelines (GitHub Actions, Buildkite, etc.), Docker-from-Docker is almost always the better choice for safety and speed unless you truly need nested isolation"
So in your situation, apparently doing local dev, not prod, Docker-from-Docker the way you're doing it would be totally reasonable. And I think the reason it worked for you on DD was that it automatically mounted the same docker sock, and you had to do that manually on OrbStack.
n
OK finally found why
else it will use the proprietary version of docker (where apparently only Docker Desktop as an underlying system works with)
r
Are you using devcontainers in VS Code or where?
n
Yes in VSCode with the official Dev Containers extension
r
Thx. Can you say a bit about why you use devcontainers with VSCode, as compared with more direct approach? I will soon be working on https://github.com/ddev/ddev/issues/7294 and it should improve devcontainer-style usage of DDEV in VS Code, so I'm always interested in how people use things.
n
Sure, I generally want to keep my Macbook base system as clean as possible and therefore try to containerize everything I can Also maybe a bit too paranoid about npm registry attacks so I try to isolate my main filesystem as much as possible as well doing that
Also thanks for ddev I was using it a lot when I was still doing PHP (just noticed that you are the maintainer) :)
r
Thanks for the feedback. What are you working with now?
n
Simple dev containers in VS code, I wanted to keep using ddev but it's a bit too opinionated for what I do know (full Typescript) so I kept it on the side for when I maintain my existing PHP apps and it is still very useful but for Typescript apps, base dev containers as said, do the work
r
Thx, so you're doing front-end or back-end work with typescript?
n
both
r
And I'd be interested if you have suggestions about how DDEV might be more useful to you with what you do with typescript. I know that the JS environment is easier in general to replicate anywhere than PHP, but interested.
n
I love ddev especially for the easyness of spinning up "sidecars" (databases, etc) but when I checked long time ago there was no easy way of making the main server end up to other things than the main php app (hence my "opinionated" message above)
I spin 20 envs a day approximately so needed something quick and easy (sort of)
r
These days DDEV has a
generic
webserver type, which means you can use any webserver you want in the main webserver. for example sveltekit or a node webserver, https://docs.ddev.com/en/stable/users/quickstart/#nodejs And of course, you can have many, many DDEV projects going at the same time, so that's another path that might help you. Always interested in your experiences and needs as a developer.
n
Nice, I will try again then, thank you for the info
r
Thank you for the feedback. We know lots of people are moving in the js direction and want to make things work well for them.
n
I mostly work (these days) with next/turborepo + supabase (hence the need of dind to start local dev database)
r
BTW if you're using the monster utlity image for devcontainers there are better base images for most things. Also, their default image is amd64 only, meaning you'd be using rosetta, not so great.
4 Views