0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】"Ports are not available: exposing port TCP 0.0.0.0:3306 -> 0.0.0.0:0: listen tcp 0.0.0.0:3306..."の対処法

Posted at

dockerのコンテナを起動させるために、いつも通りdocker compose up -dしたところ、以下のようなエラーが出た。

[+] Running 2/3
 ✔ Container app_laravel      Started                                                                  0.3s
 ✔ Container test_phpmyadmin  Started                                                                  0.3s
 ⠸ Container db               Starting                                                                 0.3s
Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:3306 -> 0.0.0.0:0: listen tcp 0.0.0.0:3306: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

原因と解決策

他のアプリにポート番号3306番が使われているのでは...?
と思い、データベース関連のアプリが裏で動いているのではと考え、Windowsのタスクマネージャーを調査。

mysqldが動いてた。

なので、タスクマネージャーから「タスクの終了」でアプリを強制終了(これはdockerだけど)。

image.png

そして再度docker compose up -dを実行。

[+] Running 4/4
 ✔ Container app_laravel      Running                                                                  0.0s
 ✔ Container test_phpmyadmin  Running                                                                  0.0s
 ✔ Container nginx            Started                                                                  0.4s
 ✔ Container db               Started                                                                  0.4s

動いた!!!

Ports are not availableと言われたら、ポートの競合を疑ってみると◎ということを学べた。

参考記事

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?