gpt4 book ai didi

postgresql - docker-entrypoint.sh忽略/docker-entrypoint-initdb.d/my.backup

转载 作者:行者123 更新时间:2023-12-02 21:31:45 28 4
gpt4 key购买 nike

我正在尝试使用以下方法初始化运行Postgres的容器

FROM postgres:9.6

COPY my.backup /docker-entrypoint-initdb.d/
在我的Dockerfile中
当我运行时,输出为:
root@pc ~ % docker run  -p 5432:5555 -e POSTGRES_PASSWORD=postgres 

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.

fixing permissions on existing directory /var/lib/postgresql/data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting default timezone ... Etc/UTCselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... oksyncing data to disk ... ok

Success. You can now start the database server using:

pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....LOG: database system was shut down at 2020-10-09 00:41:58 UTCLOG: MultiXact member wraparound protections are now enabledLOG: database system is ready to accept connectionsLOG: autovacuum launcher starteddoneserver started

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/my.backup


我已检查文件权限
如何确定初始化脚本为何忽略备份?

最佳答案

如果my.backup是一个shell脚本,则需要给它加上.sh扩展名。从the documentation:

If you would like to do additional initialization in an image derived from this one, add one or more *.sql, *.sql.gz, or *.sh scripts under /docker-entrypoint-initdb.d (creating the directory if necessary). After the entrypoint calls initdb to create the default postgres user and database, it will run any *.sql files, run any executable *.sh scripts, and source any non-executable *.sh scripts found in that directory to do further initialization before starting the service.

关于postgresql - docker-entrypoint.sh忽略/docker-entrypoint-initdb.d/my.backup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64272501/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com