1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Mac で docker-compose コマンドがエラーで動かない ( pyenv とか python とか言ってくる ) #docker

Last updated at Posted at 2020-04-12

エラー

$ docker-compose --version

Traceback (most recent call last):
  File "/Users/yumainaura/.pyenv/versions/3.7.3/bin/docker-compose", line 5, in <module>
    from compose.cli.main import main
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/compose/cli/main.py", line 17, in <module>
    import docker
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/docker/__init__.py", line 2, in <module>
    from .api import APIClient
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/docker/api/__init__.py", line 2, in <module>
    from .client import APIClient
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/docker/api/client.py", line 8, in <module>
    import websocket
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/websocket/__init__.py", line 23, in <module>
    from ._app import WebSocketApp
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/websocket/_app.py", line 36, in <module>
    from ._core import WebSocket, getdefaulttimeout
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/websocket/_core.py", line 34, in <module>
    from ._handshake import *
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/websocket/_handshake.py", line 30, in <module>
    from ._http import *
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/websocket/_http.py", line 31, in <module>
    from ._socket import*
  File "/Users/yumainaura/.pyenv/versions/3.7.3/lib/python3.7/site-packages/websocket/_socket.py", line 30, in <module>
    from ._ssl_compat import *
AttributeError: module 'websocket._ssl_compat' has no attribute 'ssl'


調べる

docker コマンドはシステム ( たぶん Docker for Mac でインストールされたやつ ) のものを使っているが
docker-compose コマンドは python のものを利用していることが判明

which docker
/usr/local/bin/docker
which docker-compose
/Users/yumainaura/.pyenv/shims/docker-compose

解決

pip の docker-compose を使わないようにした

pip uninstall docker-compose

$ which docker-compose
/usr/local/bin/docker-compose

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?