Docker & Postgres: Failed to bind tcp address already in use


I’m trying to start postgres in a docker container on my Mac, but I keep getting the following error message

docker: Error response from daemon: driver failed programming external connectivity on endpoint postgres (8392b9e5cfaa28f480fe1009dee461f97e82499726f4afc4e916358dd2d2f61e): Error starting userland proxy: Failed to bind tcp address already in use.

I have postgres installed locally, but I stopped it and running

pg_ctl status


pg_ctl: no server running

I’ve ran the following to check what’s running on 5432

lsof -i tcp:5432


netstat -anp tcp | grep 5432

and nothing is running on the port.


Mac – OS X El Capitan Version 10.11.2

PostgreSQL – 9.5

Docker – Docker version 1.12.0-rc2, build 906eacd, experimental


If lsof -i :5432 doesn’t show you any output, you can use sudo ss -lptn 'sport = :5432' to see what process is bound to the port.

Proceed further with kill <pid>

Source : Link , Question Author : user3147424 , Answer Author : Jamie

Leave a Comment