1

I have installed docker on M1 chip in Rosatta mode and Docker daemon is also running. When I try to execute "docker.from_env()" in my python code I’m getting this error

“docker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’))”

Can someone help to resolve this issue? I tried reinstalling the docker multiple times and my docker is upto date also.

I tried reinstalling the docker multiple times and my docker is upto date also.

Bas H
  • 2,114
  • 10
  • 14
  • 23
you pras
  • 11
  • 1
  • Can you verify that the standard docker environment variables are available within the python runtime? They are documented here: https://docker-py.readthedocs.io/en/stable/client.html – w08r Apr 17 '23 at 19:30

1 Answers1

0

I had the same problem after recent env update.

In my case the socket /var/run/docker.sock has gone. To fix the issue you have to create a symlink to the actual socket file (doc.docker.com)

> sudo ln -s -f /Users/<user>/.docker/run/docker.sock /var/run/docker.sock
> chmod +r /var/run/docker.sock # optional
Vadym
  • 1,444
  • 21
  • 37