Celeb Glow
news | March 25, 2026

ubuntu 20.04 sudenly using port 5432?

I was using a postgres docker just fine with ubuntu 18.04. Now I updated to ubuntu 20.04 and I suddenly can no longer start the docker, since the following error pops up - notice this error keeps appearing after freshly booting:

$ sudo docker start pg
Error response from daemon: driver failed programming external connectivity on endpoint pg (d188f0712e7079530a6d82eaf8c8770ca0ba8b755e41d87810a691e945725f52): listen tcp4 0.0.0.0:5432: bind: address already in use
Error: failed to start containers: pg

Now to see what process might be using that port I tried netstat -nlp however this gave the unhelpful line:

tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN - 

Indicating that "no PID/program name" is using that port. - What is causing ubuntu to block the common postgres port suddenly. And can I update either docker to use a different port or prevent ubuntu of blocking that port? (Without breaking stuff).


With lsof I find that a postgres database runs on that address: but what has changed with the update from 18.04 to 20.04 that suddenly this address is used? Can I find which tool is responsible for this?

$ sudo lsof -i tcp:5432
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 1285 postgres 3u IPv4 37282 0t0 TCP localhost:postgresql (LISTEN)

pstree -s 1285 (or correct version after rebooting) gives the following response:

systemd───postgres───6*[postgres]

hunting the startup processes using sudo systemctl list-unit-files --type=service

returns amongst the lines the following:

postgresql.service enabled enabled
postgresql@.service indirect enabled

But this still doesn't give me a clue what caused the postgres service to start running on my pc (or what application is responsible).

4 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy