我正在尝试启动PostgreSQL数据库容器。启动容器时,我还希望在其中创建模式和表。通过安装卷并在dockerEntrypoint中运行dql文件,可以创建我的架构和表(日志这样说)。
但是,\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/
最佳答案
我想这已解决,这是Not able to view any relations inside the created schema
另一个问题中提供给您的解决方案的一部分
披露:我为EnterpriseDB (EDB)工作
关于postgresql - postgres容器在容器内部没有任何关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63277291/