LucasPG
LucasPG

Reputation: 433

Docker container exits immediately after running or restarting PostgreSQL image

I am begginer with docker, and I stuck in place due to container restarting problem. The problem occures when I try to restart an existing exited container, or create new container (after deleting old one) running:

docker run -d --name mempostgres \
    -v "/home/lukasz/lc_pg_data:/var/lib/pgsql/data:Z" \
    -e POSTGRES_USER=postgres \
    -e POSTGRES_PASSWORD=password \
    -e POSTGRES_DB=dbName \
    -p 5432:5432 \
    fedora/postgresql

My container always exits immediately with status "Exited(1)"

Inside the logs of my container i have: enter image description here

However I don't have any PostgreSQL server running at this moment.

Upvotes: 2

Views: 7276

Answers (2)

dawciobiel
dawciobiel

Reputation: 1805

Postgres should conatain password environmental variable as below: -e POSTGRES_PASSWORD=postgres

Add also, pgadmin should have two environmental variables(email and passworld) as below: -e '[email protected]' -e 'PGADMIN_DEFAULT_PASSWORD=postgresmaster'

This is the email address used when setting up the initial administrator account to login to pgAdmin. This variable is required and must be set at launch time.

If these details are not given postgres and pgadmin will go to exited state.

Upvotes: 2

kstromeiraos
kstromeiraos

Reputation: 5027

You need to kill that postmaster process.

cat .../postmaster.pid

The first number of this file is the PID of postmaster process.

Then, kill that process using:

kill PID

Finally, run a container, your problem should be fixed.

Upvotes: 2

Related Questions