I have the following config lines:
RUN sudo apt-get -y install postgresql
USER postgres
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER test WITH SUPERUSER PASSWORD 'test';" &&\
createdb -O test test
EXPOSE 5432
CMD ["mono", "src/Rest.Api/bin/Debug/Rest.Api.exe"]
However, running the final command to spin up my API yields this:
setting listen on
Failed to establish a connection to 'localhost'.
at Npgsql.NpgsqlClosedState.Open (Npgsql.NpgsqlConnector context, Int32 timeout) [0x00000] in <filename unknown>:0
at Npgsql.NpgsqlConnector.Open () [0x00000] in <filename unknown>:0
at Npgsql.NpgsqlConnectorPool.GetPooledConnector (Npgsql.NpgsqlConnection Connection) [0x00000] in <filename unknown>:0
exit
Which looks like PostgreSQl isn't running - what do I need to do to get postgresql running?