LoginSignup
3
0
記事投稿キャンペーン 「2024年!初アウトプットをしよう」

【エラー】Ports are not available: ~ already in use 対処法

Last updated at Posted at 2024-01-24

PostgreSQLを使用して出たエラーです。

下記のエラーが出ました。

Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5432 -> 0.0.0.0:0: listen tcp 0.0.0.0:5432: bind: address already in use


ポート番号5432は使われていると出たので、何を開いているのか確認してみました。
lsof -i :5432

何も出てきません。




スーパーユーザ権限でリスニング状態のネットワーク接続(サーバーが接続を待っているポートなど)を表示

sudo lsof -i -P | grep "LISTEN"


以下の出力から、PostgreSQLデータベースがポート5432でリスニングしており、外部からの接続を待ち受けている状態を示しています。

postgres   584          postgres    8u  IPv6 000000000000000000      0t0    TCP *:5432 (LISTEN)
postgres   584          postgres    9u  IPv4 000000000000000000      0t0    TCP *:5432 (LISTEN)


ポート番号5432で立ち上げたいため、5432で立ち上がっているPID 584のものを終了させます。

sudo kill 584


立ち上げができました🎉

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