How to make the configuration of the postgres plug-in that docker?

Take postgres for the management of the docks Docker.
docker build-t my/postgres .
FROM ubunru
RUN apt-get install -y python-software-properties software-properties-common postgresql-9.5 postgresql-client-9.5, postgresql-contrib-9.5
USER postgres
RUN /etc/init.d/postgresql start &&\
 psql --command "CREATE USER myuser WITH SUPERUSER PASSWORD 'pmyuser';" &&\
 createdb -O myuser myuser
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
EXPOSE 5432
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
ENTRYPOINT /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main-c config_file=/etc/postgresql/9.5/main/postgresql.conf


Start
docker run-d --name=PGmaster \
 -p 5432:5432 \
 -v /opt/postgres/etc:/etc/postgresql/9.5/main \
 -v /opt/postgres/log:/var/log/postgresql \
 -v /opt/postgres/data/var/lib/postgresql \
 my/postgres


Postgres writes that the configs are not found. Yes, the mounting is done after Assembly of the container and it's overwriting existing files.
How best to return it to the config?
July 9th 19 at 11:25
1 answer
July 9th 19 at 11:27
I had similar with "mysql". There are five solutions:
1. To use the official container, there may be this problem is already solved and using linking to connect it to where you need postgres
2. You already have the config and you fill up while creating container using "COPY" or "ADD"
3. To make a script (to Put in ENTRYPOINT) which will check a certain folder. If the folder exists and it is empty, then there kopirate config and start postgres with it if the folder is not present, then start with the original config. Turns out that when you build it be to use the original config, and at the start it will be necessary to mount the folder (which will be checked in the script). The script will throw back the config and will use it for the next races. Look at this project (run.sh), but there is a hell. There is still a lot of other things for mysql and icinga.
4. To use the "sed" and change/add settings in /etc/postgresql/9.5/main/postgresql.conf
5. If you have any special settings, then what for it then to touch

Find more questions by tags Docker