PostgreSQL DockerFile

I am writing DockerFile for PostgreSQL. The image is building successfully, but container not able to start up saying not able to access the pg_hba.conf file,no such file. I am providing data directory with -D switch in initdb command to create the PG related data and config files in different dorectory. But when i am manually running the same command in a container , its running successfully.

Any pointers what could be the issue ?

So not exactly sure why you don’t just pull in the official postgreSQL image and build off that.

If you want to build it from scratch why not just compare what you have done to the official repo’s docker file? ie https://github.com/docker-library/postgres