Cannot find Docker Daemon in DinD-Rootless Setup

72 views Asked by At

I am currently trying to get "Docker in Docker" to work on macOS. I have Docker Desktop installed and it's currently active on my system.

I did my research and tried to make a devcontainer with the following setup:

devcontainer.json:

{
    "name": "Docker",
    "dockerFile": "Dockerfile",
    "runArgs": ["--privileged"],
    "postCreateCommand": "dockerd-entrypoint.sh --experimental &",
    "remoteUser": "rootless"
}

Dockerfile:

FROM docker:dind-rootless
USER root
RUN apk add git bash curl make vim go
USER rootless
ENV DOCKER_HOST=unix:///run/user/1000/docker.sock

VS Code was able to build my devcontainer, and I was able to see that we indeed have docker and docker-compose installed in the container. When I tried to do docker info to ensure we are connected to our docker daemon, I see this message at the bottom:

ERROR: Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?

How do I fix this issue? If I can't connect to my daemon, then I won't be able to use docker compose with my own project setup.

Would this be an issue specific to macOS? I intend on running it on a Windows system with WSL2.

Thanks!

0

There are 0 answers