Docker Error in CLI: `Bind for 0.0.0.0:5432 failed: port is already allocated`

Running astro airflow start by default will start your project with the Airflow Webserver exposed at port 8080 and postgres exposed at port 5432.

If you’re getting this error, that means that you already have Postgres running locally on port 5432, assumedly for something else.

If you can and want to stop that Postgres from running, you can do the following:

  1. List running containers by running docker ps from your terminal
  2. Take the id and do docker stop {container_id} from there
    OR
    run docker stop $(docker ps -q) to stop all containers.

If you for some reason you can’t stop that Postgres from running, there is a way to change the port via a change to your config.yaml file. For that workaround, check out this forum post.