Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS MWAA: 'Postgres not reachable' error when trying to run a local Apache Airflow environment on Docker

Following the AWS MWAA (Amazon Managed Workflows for Apache Airflow) installation tutorial for Windows using Docker in WSL (Windows Subsystem for Linux) 2 with Ubuntu distro, I encountered a problem when trying to run a local Apache Airflow environment.

When I input the command wsl ./mwaa-local-env start, this is the output:

docker-postgres-1      | chmod: /var/lib/postgresql/data: Operation not permitted
docker-postgres-1      | The files belonging to this database system will be owned by user "postgres".
docker-postgres-1      | This user must also own the server process.
docker-postgres-1      |
docker-postgres-1      | The database cluster will be initialized with locale "en_US.utf8".
docker-postgres-1      | The default database encoding has accordingly been set to "UTF8".
docker-postgres-1      | The default text search configuration will be set to "english".
docker-postgres-1      |
docker-postgres-1      | Data page checksums are disabled.
docker-postgres-1      |
docker-postgres-1      | fixing permissions on existing directory /var/lib/postgresql/data ... initdb: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
docker-postgres-1 exited with code 1
docker-local-runner-1  | Sat Feb 12 21:14:01 UTC 2022 - waiting for Postgres... 1/20
docker-local-runner-1  | Sat Feb 12 21:14:26 UTC 2022 - waiting for Postgres... 2/20
docker-local-runner-1  | Sat Feb 12 21:14:51 UTC 2022 - waiting for Postgres... 3/20
docker-local-runner-1  | Sat Feb 12 21:15:16 UTC 2022 - waiting for Postgres... 4/20
docker-local-runner-1  | Sat Feb 12 21:15:41 UTC 2022 - waiting for Postgres... 5/20
docker-local-runner-1  | Sat Feb 12 21:16:06 UTC 2022 - waiting for Postgres... 6/20
docker-local-runner-1  | Sat Feb 12 21:16:32 UTC 2022 - waiting for Postgres... 7/20
docker-local-runner-1  | Sat Feb 12 21:16:57 UTC 2022 - waiting for Postgres... 8/20
docker-local-runner-1  | Sat Feb 12 21:17:22 UTC 2022 - waiting for Postgres... 9/20
docker-local-runner-1  | Sat Feb 12 21:17:47 UTC 2022 - waiting for Postgres... 10/20
docker-local-runner-1  | Sat Feb 12 21:18:12 UTC 2022 - waiting for Postgres... 11/20
docker-local-runner-1  | Sat Feb 12 21:18:37 UTC 2022 - waiting for Postgres... 12/20
docker-local-runner-1  | Sat Feb 12 21:19:03 UTC 2022 - waiting for Postgres... 13/20
docker-local-runner-1  | Sat Feb 12 21:19:28 UTC 2022 - waiting for Postgres... 14/20
docker-local-runner-1  | Sat Feb 12 21:19:53 UTC 2022 - waiting for Postgres... 15/20
docker-local-runner-1  | Sat Feb 12 21:20:19 UTC 2022 - waiting for Postgres... 16/20
docker-local-runner-1  | Sat Feb 12 21:20:44 UTC 2022 - waiting for Postgres... 17/20
docker-local-runner-1  | Sat Feb 12 21:21:09 UTC 2022 - waiting for Postgres... 18/20
docker-local-runner-1  | Sat Feb 12 21:21:34 UTC 2022 - waiting for Postgres... 19/20
docker-local-runner-1  | Sat Feb 12 21:21:59 UTC 2022 - postgres:5432 still not reachable, giving up
docker-local-runner-1 exited with code 1
like image 690
Stan Lyons Avatar asked Oct 20 '25 22:10

Stan Lyons


1 Answers

This solution fixed it for me:

  1. docker volume create --name=db-data to create a db-data volume in docker

  2. In file docker-compose.yaml change this line:

    - "${PWD}/db-data:/var/lib/postgresql/data"

    to this:

    - "/db-data:/var/lib/postgresql/data"

Credits to : https://github.com/aws/aws-mwaa-local-runner/issues/45

like image 114
A H Avatar answered Oct 22 '25 13:10

A H



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!