im runnning postgres alpine latest version in podman with podman-compose
here is my compose file:
volumes:
pgdata:
services:
db:
image: docker.io/library/postgres:alpine
container_name: postgres_container
env_file:
- .env
volumes:
- pgdata:/var/lib/postgresql/data/pgdata
healthcheck:
test: ["CMD-SHELL", "pg_isready --dbname=${POSTGRES_DB} --username=${POSTGRES_USER}"]
interval: 10s
retries: 5
timeout: 5s
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
shm_size: 128mb
restart: unless-stopped
.env file
POSTGRES_USER=postgres_user
POSTGRES_PASSWORD=password
POSTGRES_DB=postgres_db
the issue:
healthcheck returns error and condition healthy never arrives. status of the container hangs on 'starting' if i use healtcheck in compose.
however if i manually run pg_isready on the container from host, there seems to be nothing that would indicate that something is 'not healthy'.
in logs, i see that healthcheck command is probably getting this FATAL value from the postgres container:
[db] | 2026-05-23 13:22:14.761 UTC [1] LOG: database system is ready to accept connections
[db] | 2026-05-23 13:22:21.449 UTC [68] FATAL: database "postgres_user" does not exist // this is when i manually call pg_isready from the host to the container
[db] | 2026-05-23 13:22:30.899 UTC [70] FATAL: database "postgres_user" does not exist
however when i run pg_isready from the host i receive this on stdout:
$ podman exec postgres_container pg_isready -U postgres_user -d posgtres_db
/var/run/postgresql:5432 - accepting connections
also here it looks like the db exists, contrary to logs:
podman exec postgres_container psql -U postgres_user -l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | Locale | ICU Rules | Access privileges
-------------+---------------+----------+-----------------+------------+------------+--------+-----------+---------------------------------
postgres | postgres_user | UTF8 | libc | en_US.utf8 | en_US.utf8 | | |
postgres_db | postgres_user | UTF8 | libc | en_US.utf8 | en_US.utf8 | | |
to me at least, it indicates that there is no error and the database exists. maybe i am missing something
im runnning postgres alpine latest version in podman with podman-compose
here is my compose file:
.env file
the issue:
healthcheck returns error and condition healthy never arrives. status of the container hangs on 'starting' if i use healtcheck in compose.
however if i manually run pg_isready on the container from host, there seems to be nothing that would indicate that something is 'not healthy'.
in logs, i see that healthcheck command is probably getting this FATAL value from the postgres container:
however when i run pg_isready from the host i receive this on stdout:
also here it looks like the db exists, contrary to logs:
to me at least, it indicates that there is no error and the database exists. maybe i am missing something