Sitemap

Member-only story

Docker Compose Port is already Allocated

2 min readOct 6, 2020

--

Are you getting this error using Docker Compose?

Bind for 0.0.0.0:5432 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.

In this article, We will show you how you can resolve this error

The cause of this error is docker container was still running in the background with the allocated port

In our case, we have tried to run Postgres with port 5432

Then we tried to stop the docker first using the following command

Stop Docker

docker stop $(docker ps -a -q)

Remove Containers

then we removed the containers using the following command

docker rm $(docker ps -a -q)

Run the Docker

After running the container using the following command there is no Port already allocated error as shown in the screenshot.

docker-compose up

Thank you!

πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘

--

--

No responses yet