Dokcer Compose 遇到 Python 3.6 不再支援問題

2023-05-09
1 min read

解決 docker-compose 警告 Python 3.6 不再支援問題。

可能已經發生一時間了,但是最近才注意到 XD。

在使用 docker-compose down 或是 docker-compose up,都會出現下面這個訊息:

/snap/docker/2746/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
  from cryptography.hazmat.backends import default_backend

雖然已經確定使用 Python 3.10,查看 docker-compose 版本也確實發現它還是使用 Python 3.6:

xxxx@xxxx:~/oooo/ooxx$ sudo docker-compose version
/snap/docker/2746/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
  from cryptography.hazmat.backends import default_backend
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.6.9

這是因為 docker-compose 這個命令已經過時了,請改用 docker compose 就可以了。
要是習慣改不過來,不妨就加個alias吧:

alias docker-compose='docker compose'
Avatar

Awin Huang

有物混成,先天地而生,寂兮寥兮,獨立而不改,周行而不殆,可以為天下母。吾不知其名,字之曰道。
comments powered by Disqus