Intermittent port clash with postgres

networking
docker
postgresql

#1

We’re building a dockerized app that’s backended with postgres. The circleci container spins up a local postgres server on port 5432 which we stop in our circle.yml and replace with our own postgres container in our docker-compose config. We do this so that our app container gets an automatic link to our db container.

About 1 in 3 builds fail because our db container is unable to bind to 5432 (it’s the default postgres image) presumably because the circleci postgres either didn’t stop, restarted or didn’t release the port.

How do we stop these clashes?


#2

I got same issue with Mongodb 27017. After stopping MongoDB, CircleCi seems auto re-start it.
My solution is uninstall Mongodb :D.
You can try to remove Postgres in CircleCI.


#3