Docker Community Forums

Share and learn in the Docker community.

Unable to start postgresql and apache from a single dockerfile

Hello guys, sinc two days now i created an Angular application which consumes a data from a php web service connected to a postgres database. I want to dockerize the application as a single container so i created a single dockerfile (content below), but when i run the container, the web service(deployed in apache) is not working and unable to connect to postgres. Only the angular(deployed in nginx) is working. Please i really need help, what i’m i doing wrong :

 ## STAGE 2 : Run nginx to serve application ##
FROM node:12 as builder

WORKDIR .

FROM yvantakoumbo94/postgres-gabon-data:v3

USER postgres
ENV PGDATA /postgres
ENV POSTGRES_DB_HOST postgres
ENV POSTGRES_DB_PORT 5432
ENV POSTGRES_DB_USER postgres
ENV POSTGRES_DB_PASSWORD pgadmin@
ENV POSTGRES_DB_NAME terres_gabon

FROM  php-apache-terres-api:v4

RUN service apache2 start

WORKDIR .
FROM nginx
COPY nginx.conf /etc/nginx/nginx.conf

RUN rm -rf /usr/share/nginx/html/*
COPY  /dist/terreGabonaise /usr/share/nginx/html/


ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 4200
EXPOSE 80
EXPOSE 5432

CMD ["postgres"]