Creating Docker SDK client failed

Bug Report: Docker SDK Client Failed on Apple MacBook Pro M1

Environment:

  • Device: Apple MacBook Pro with M1 chip
  • MacOS: Ventura 13.4.1
  • Docker Version: Docker Desktop (AppleSilicon installed via .dmg) and Docker client. Same version v24.0.6
  • Python Version: 3.11.6
  • Python Libraries:
    • requests: 2.28.1
    • urllib: 1.26.16
  • Configuration: “Allow the default Docker socket to be used” (under Advanced settings) is checked. Rosetta installed.
  • Additional Info: sudo chmod 666 /var/run/docker.sock and sudo ln -s $HOME/.docker/run/docker.sock /var/run/docker.sock was run. This is my local personal machine.
    I tried installing and reinstalling Docker Desktop many times. If you have any suggestions, please let me know. Thank you!

Error Description:
DEBUG: Creating Docker SDK client failed: Error while fetching server API version: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’))

Traceback (most recent call last):
File “/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 714, in urlopen
httplib_response = self._make_request(

File “/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py”, line 30, in connect
sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/adapters.py”, line 486, in send
resp = conn.urlopen(

File “/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py”, line 30, in connect
sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’))