If you’re using docker desktop on MacOS, and given that it works when you run it manually, perhaps your docker.sock is located at another path that is not
/var/run/docker.sock
.
Assuming docker desktop, what version are you using?
I’m using docker desktop 4.12 on MacOS, which symlinks by default the
/var/run/docker.sock
path to your actual docker.sock, for example mine looks like this:
cictor@Victors-MacBook-Pro % ls -la /var/run/docker.sock
lrwxr-xr-x 1 root daemon 37 May 29 12:51 /var/run/docker.sock -> /Users/cictor/.docker/run/docker.sock
Version 4.13.0 of docker desktop does not create this symlink anymore:
https://docs.docker.com/desktop/release-notes/
• By default Docker will not create the /var/run/docker.sock symlink on the host and use the docker-desktop CLI context instead.
Version 4.13.1 added it back:
• Added back the /var/run/docker.sock
symlink on Mac by default, to increase compatibility with tooling like tilt
and docker-py
. Fixes docker/for-mac#6529.
So if you’re using exactly version 4.13.0, that would be a problem. Please check