Sto provando a impostare le informazioni di base postgres dalla mia finestra mobile-compose. Il contenitore si avvia ma le variabili da Dockerfile
non vengono sovrascritte quando si esegue docker-compose up
. Per favore aiuto.docker-compose non sovrascrive le variabili di ambiente file docker
FROM mine/debian7
## START: UPDATES & INSTALLS ###########################################################################################
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" >> /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - && \
apt-get update && \
apt-get upgrade && \
apt-get install -y python-software-properties software-properties-common postgresql-9.4 postgresql-client-9.4 postgresql-contrib-9.4 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## END: UPDATES & INSTALLS #############################################################################################
ENV DB_USER_NAME test
ENV DB_PASSWORD test
ENV DB_NAME test
## START: CONCFIGURATION ###############################################################################################
# start postgres at boot
#RUN echo "/etc/init.d/postgresql start" >> ~/.bashrc
USER postgres
RUN /etc/init.d/postgresql start && \
psql --command "CREATE USER $DB_USER_NAME WITH SUPERUSER PASSWORD '$DB_PASSWORD';" && \
createdb -O $DB_NAME $DB_NAME
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.4/main/pg_hba.conf
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
#USER root
#RUN update-rc.d postgresql defaults
## END: CONCFIGURATION #################################################################################################
EXPOSE 5432
CMD service postgresql start && tail -f /var/log/postgresql/postgresql-9.4-main.log
E il mio file di finestra mobile-composizione:
tomcat:
image: clegge/tomcat
ports:
- "8080:8080"
volumes:
- sample.war:/opt/tomcat7/webapps/sample.war
postgres:
build: /Users/clegge/Dockers/docker-postgres-base/
ports:
- "5432:5432"
stdin_open: true
tty: true
environment:
- DB_USER_NAME=legge_crud
- DB_PASSWORD=legge_crud
- DB_NAME=test
Che cosa mi manca?
stavo cercando di fare qualcosa del genere: https://hub.docker.com/r/appcontainers/mysql/ ma non ho notato gli script di installazione. –