igor
igor

Reputation: 81

Service postgresql is stopped in the running docker container with postgres image

I have running container docker run -it --rm -d postgres. I can even connect to it with 172.17.0...:5432 IP. But

$service --status-all
 [ - ]  cron
 [ - ]  exim4
 [ ? ]  hwclock.sh
 [ - ]  postgresql
 [ - ]  procps
 [ - ]  sysstat

How can postgres work if service even hasn't been started ?

Upvotes: 1

Views: 1314

Answers (1)

Chris
Chris

Reputation: 1096

You do not provide any port mappings when starting the container. My guess is that you are connecting to your locally installed Postgres instance instead of your postgres container.

Start the postgres container with: docker run --rm -p:5433:5432 -d postgres

Then connect by using the port 5433.

Upvotes: 1

Related Questions