macOS Big Surをアップグレードしたらdocker-composeでエラーが発生


2021年5月2日(日)にmacOS BigSurを バージョン 11.3 アップグレードしたら、docker-compseでエラーが出るようになりました。

% docker-compose up
Traceback (most recent call last):
  File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
  File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1252, in request
  File "http/client.py", line 1298, in _send_request
  File "http/client.py", line 1247, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 966, in send
  File "site-packages/docker/transport/unixconn.py", line 43, in connect
FileNotFoundError: [Errno 2] No such file or directory
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 67, in main
  File "compose/cli/main.py", line 123, in perform_command
  File "compose/cli/command.py", line 69, in project_from_options
  File "compose/cli/command.py", line 132, in get_project
  File "compose/cli/docker_client.py", line 43, in get_client
  File "compose/cli/docker_client.py", line 170, in docker_client
  File "site-packages/docker/api/client.py", line 188, in __init__
  File "site-packages/docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))


% brew upgrade

Please update your Command Line Tools (CLT) or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
% softwareupdate --all --install --force
% sudo rm -rf /Library/Developer/CommandLineTools
% sudo xcode-select --install
コマンド 意味
brew upgrade Homebrewのアップデートに加えて、Homebrewでインストールしたパッケージのアップデートも行う
xcode-select --install Command Line Toolsをインストールする


Docker デーモンを起動させましょう。
Docker Desktopを動かすだけで解消しました。


Docker がちゃんと動いているか確認してみてください。


Pythonのバージョンを 2.7.16 から3.9.4にあげてみました。

% python -V
Python 2.7.16
% brew install pyenv
% pyenv -v
pyenv 1.2.27
% echo 'eval "$(pyenv init -)"' >> ~/.zshrc
% pyenv install 3.9.4
% pyenv versions
% pyenv global 3.9.4
% pyenv versions
* 3.9.4 (set by /Users/hoge/.pyenv/version)