【WSL2 Docker】 「docker-compose up」にてPorts are not availableエラーが発生したとき
概要
- docker upを実行したときに
ERROR: for app Cannot start service app: Ports are not available: listen tcp 0.0.0.0:50080: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
ERROR: Encountered errors while bringing up the project.
ERROR: for app Cannot start service app: Ports are not available: listen tcp 0.0.0.0:50080: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
ERROR: Encountered errors while bringing up the project.
そのエラーが出たときに調べたことと対応について記録します。
本文
調べたこと
原因についていくつかの候補が上がりました。
Portが埋まっている
Portがほかで使われている可能性を考え、netstat -oa
で確認しましたが、確認ができませんでした。
対応
docker-compose.ymlに記載したPort番号を変更しました。50080で最初設定しており、50081に変更しても結果が変わらなかったため、カーネルに占有されていることが候補としてあがりました。
以下に記載した資料によると、49152以降の番号を使うとエフェメラルポートと被りそうです。
なので、初期状態から49152よりも前のPort番号を使えばよさそうです。
参考
Author And Source
この問題について(【WSL2 Docker】 「docker-compose up」にてPorts are not availableエラーが発生したとき), 我々は、より多くの情報をここで見つけました https://qiita.com/zaki89/items/89d50948cd831c8870a8著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .