Docker Community Forums

Share and learn in the Docker community.

Link pact-broker container to postgresql local installation

docker

(Aphexlog) #1

my dockerfile is as follows:

FROM phusion/passenger-ruby24:0.9.26

ENV APP_HOME=/home/app/pact_broker/
RUN rm -f /etc/service/nginx/down /etc/nginx/sites-enabled/default
COPY container /
RUN gem update --system
# USER app

COPY pact_broker/config.ru pact_broker/Gemfile pact_broker/Gemfile.lock $APP_HOME
# Update system gems for:
# https://www.ruby-lang.org/en/news/2017/08/29/multiple-vulnerabilities-in-rubygems/
RUN gem install bundler && \
    cd $APP_HOME && bundle install --deployment --without='development test'
COPY pact_broker/ $APP_HOME/
RUN chown -R app:app $APP_HOME

EXPOSE 80
CMD ["/sbin/my_init"]

I need to make this docker container speak to my local postgresql installation on the host…

What would I need to add to this file in order to make this happen?

my run command is as follows:
docker run --name pactbroker --link pactbroker-db:postgres -e PACT_BROKER_DATABASE_USERNAME=pactbroker -e PACT_BROKER_DATABASE_PASSWORD=pactbroker -e PACT_BROKER_DATABASE_HOST=127.0.0.1 -e PACT_BROKER_DATABASE_NAME=pactbroker -d -p 80:80 dius/pact-broker