Open valentincodes opened 2 months ago
Can you please explain in some more detail!
When running
doctl app dev build
I get ✔ fetching app details ✔ loading config from app ▸ current app dev workspace: ✔ preparing app dev environment Error: preparing build environment: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Docker is running but location is /Users/<user>/.docker/run/docker.sock
I am having the same issue. I've had it before with different projects due to the way Docker Desktop sets things up nowadays.
Creating a symlink to the local user socket solves it:
sudo ln -s /home/youruser/.docker/desktop/docker.sock /var/run/docker.sock
I can see the source code evals symlinks in the hardcoded path, unsure if the Docker Desktop installation was supposed to create it and failed, but it does work when the symlink is manually created.
It seems the command still fails, albeit much further down the line now. I can see my app's build stage being completed, and the following error comes after that:
╭──────────── container image ───────────╼
│ › creating app container image
│ ERROR: failed to initialize docker client: failed to connect to docker socket: dial unix /var/run/docker.sock: connect: connection refused
│
│ command exited with code 1
│ ✘ image creation failed
Error: command exited with a non-zero status code
I have tried with both the symlink and by prepending DOCKER_HOST to the command, like so: DOCKER_HOST=unix:///home/youruser/.docker/desktop/docker.sock doctl app dev build
. Either combination of workarounds always results in the mentioned output.
This issue in buildpacks seems to hint that the export container fails to access the Docker daemon, due to non standard daemon socket location. One workaround in there is to run pack with the --docker-host=inherit
flag, but there's no way for me to inject that flag into doctl's chain to test it. The issue has been open since Dec 1, 2021, so don't know if it is preferable to wait for it to be closed on buildpack's side, or detect this scenario and inject the flag on doctl's side.
https://github.com/digitalocean/doctl/blob/9282784517cb25d3cb6b06a4895626b173177603/internal/apps/builder/cnb.go#L36
Error: preparing build environment: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Socket location:
/Users/<user>/.docker/run/docker.sock