# Intermittent port clash with postgres

**URL:** <https://discuss.circleci.com/t/intermittent-port-clash-with-postgres/5014>\
**Category:** Build Environment\
**Tags:** postgresql, docker, networking\
**Created:** [July 7, 2016, 2:56pm UTC](https://discuss.circleci.com/t/intermittent-port-clash-with-postgres/5014 "2016-07-07T14:56:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robstyles](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/robstyles/32/13425_2.png) [@robstyles](https://discuss.circleci.com/u/robstyles)\
**Post date:** [July 7, 2016, 2:56pm UTC](https://discuss.circleci.com/t/intermittent-port-clash-with-postgres/5014/1 "2016-07-07T14:56:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:38am UTC](https://discuss.circleci.com/t/intermittent-port-clash-with-postgres/5014/3 "2018-06-18T11:38:29Z")

</div>

Closed on June 18, 2018, 11:38am UTC


