0
respostas

Ajuda com DockerFile Postgres

Bom dia Galera Alguém consegue me ajudar com a construção de um docker File ?

FROM postgres:10
MAINTAINER Ferreira Felipe

ENV POSTGRES_PASSWORD=1234
COPY ./database/backup /var/lib/postgresql/backup

RUN localedef -i pt_BR -c -f UTF-8 -A /usr/share/locale/locale.alias pt_BR.UTF-8
#CMD [ "postgres", "-c", "standard_conforming_strings=off"]

RUN psql -U postgres --command="create database vr;"
RUN psql -U postgres -d vr --command="drop schema public;"
RUN psql -U postgres --command="ALTER USER postgres WITH ENCRYPTED PASSWORD '123@456';"
RUN psql -U postgres --command="CREATE ROLE pgsql LOGIN  SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;"
RUN psql -U postgres --command="ALTER USER pgsql WITH ENCRYPTED PASSWORD '123@456';"
RUN psql -U postgres --command="CREATE ROLE controller360 LOGIN  SUPERUSER  INHERIT  NOCREATEDB  NOCREATEROLE NOREPLICATION;"
RUN psql -U postgres --command="CREATE USER desenvolvimento;"
RUN psql -U postgres --command="CREATE USER implantacao;"
RUN psql -U postgres --command="CREATE ROLE arcos;"
RUN psql -U postgres --command="ALTER USER arcos WITH ENCRYPTED PASSWORD 'arcos';"
RUN psql -U postgres --command="CREATE USER mercafacil;"
RUN psql -U postgres --command="ALTER USER mercafacil WITH ENCRYPTED PASSWORD 'mercafacil';"
RUN psql -U postgres --command="CREATE USER mixfiscal;"
RUN psql -U postgres --command="ALTER USER mixfiscal WITH ENCRYPTED PASSWORD 'mixfiscal';"
RUN psql -U postgres --command="CREATE USER pagpouco;"
RUN psql -U postgres --command="ALTER USER pagpouco WITH ENCRYPTED PASSWORD 'pagpouco';"
RUN psql -U postgres --command="CREATE USER simix;"
RUN psql -U postgres --command="ALTER USER simix WITH ENCRYPTED PASSWORD 'simix';"
RUN psql -U postgres --command="CREATE USER marketscience;"
RUN psql -U postgres --command="ALTER USER marketscience WITH ENCRYPTED PASSWORD 'marketscience';"
RUN psql -U postgres --command="CREATE USER berrytech;"
RUN psql -U postgres --command="ALTER USER berrytech WITH ENCRYPTED PASSWORD 'berrytech';"
RUN psql -U postgres --command="CREATE USER vr;"
RUN pg_restore -U postgres -d vr /var/lib/postgresql/backup/vrFrioseCia.backup


EXPOSE 5432

Quando tento executar a Build

docker build -f postgres.dockerfile -t ferreirafelipe/postgresvr .

Recebo a seguinte mensagem de error Insira aqui a descrição dessa imagem para ajudar na acessibilidade

Um detalhe se eu crio o container na mao

docker run --name postgres-vr --network rede-vr -p 5432:5432 -v /vr/database/postgres:/var/lib/postgresql/data -e POSTGRES_PASSWORD=1234 -d postgres

e executos os psql separadamente no container

docker exec -it 5e0 psql -U postgres -c 'create database vr;'

Consigo subir o backup da base normalmente.