Я пытаюсь запустить контейнер базы данных PostgreSQL. Когда контейнер запускается, я также хочу, чтобы в нем были созданы схема и таблицы. При монтировании тома и запуске файла dql внутри dockerEntrypoint моя схема и таблицы создаются (об этом говорят журналы).
Однако \dt
не дает «никаких отношений». Почему это так?
Не могли бы вы помочь
Журналы ниже:
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data -l logfile start
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
waiting for server to start....2020-08-05 08:49:25.407 UTC [46] LOG: starting PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2020-08-05 08:49:25.409 UTC [46] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-08-05 08:49:25.428 UTC [47] LOG: database system was shut down at 2020-08-05 08:49:25 UTC
2020-08-05 08:49:25.433 UTC [46] LOG: database system is ready to accept connections
done
server started
CREATE DATABASE
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/imcsysdb.sql
CREATE SCHEMA
CREATE TABLE
2020-08-05 08:49:25.654 UTC [46] LOG: received fast shutdown request
waiting for server to shut down....2020-08-05 08:49:25.656 UTC [46] LOG: aborting any active transactions
2020-08-05 08:49:25.657 UTC [46] LOG: background worker "logical replication launcher" (PID 53) exited with exit code 1
2020-08-05 08:49:25.658 UTC [48] LOG: shutting down
2020-08-05 08:49:25.675 UTC [46] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2020-08-05 08:49:25.768 UTC [1] LOG: starting PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2020-08-05 08:49:25.769 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-08-05 08:49:25.769 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-08-05 08:49:25.772 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-08-05 08:49:25.789 UTC [73] LOG: database system was shut down at 2020-08-05 08:49:25 UTC
2020-08-05 08:49:25.794 UTC [1] LOG: database system is ready to accept connections
Dockerfile:
FROM postgres
ENV POSTGRES_USER postgres
ENV POSTGRES_PASSWORD postgres
ENV POSTGRES_DB MYAPP
COPY /myappddl.sql /docker-entrypoint-initdb.d/