В браузере с проектом postgres:
Connection error: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? could not connect to server: Address not available Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
В логах докер-контейнера:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
2021-02-27 15:42:35.809 GMT [1] LOG: input in flex scanner failed at file "/etc/postgresql.conf" line 1
2021-02-27 15:42:35.809 GMT [1] FATAL: configuration file "/etc/postgresql.conf" contains errors
PgAdmin намекает на отсутсвие пользователя:
команда
docker-compose exec postgres psql -U postgres
выдает
Container 212bf5... is restarting, wait until the container is running
а такая
docker-compose run --rm postgres psql -U postgres
выдает
psql: error: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
мой
docker-compose.yml
php:
build:
context: .
dockerfile: php.dockerfile
container_name: php
volumes:
- ./src:/var/www/html:delegated
networks:
- laravel
postgres:
image: 'postgres:latest'
container_name: postgree
restart: 'always'
environment:
POSTGRES_DB: db_pg
POSTGRES_USER: user
POSTGRES_PASSWORD: password
ports:
- 5432:5432
volumes:
- ./postgres/conf/postgresql.conf:/etc/postgresql.conf
command: postgres -c config_file=/etc/postgresql.conf
networks:
- laravel
phppgadmin:
image: 'dockage/phppgadmin:latest'
container_name: phppgadmin
restart: 'always'
ports:
- '8090:80'
depends_on:
- postgres
links:
- postgres
environment:
PHP_PG_ADMIN_SERVER_DESC: PostgreSQL
PHP_PG_ADMIN_SERVER_HOST: pgsql
PHP_PG_ADMIN_SERVER_PORT: 8090
PHP_PG_ADMIN_SERVER_SSL_MODE: allow
PHP_PG_ADMIN_SERVER_DEFAULT_DB: db_pg
PHP_PG_ADMIN_SERVER_PG_DUMP_PATH: /usr/bin/pg_dump
PHP_PG_ADMIN_SERVER_PG_DUMPALL_PATH: /usr/bin/pg_dumpall
networks:
- laravel
php.dockerfile
FROM php:7.4-fpm-alpine
RUN apk update && apk add \
postgresql-dev
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install pdo pdo_pgsql
ADD ./php/www.conf /usr/local/etc/php-fpm.d/www.conf
RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel
RUN mkdir -p /var/www/html
RUN chown laravel:laravel /var/www/html
WORKDIR /var/www/html
Подскажите, как исправить?