擅长:python、mysql、java
<p>第一次运行<code>docker-compose up</code>时,使用配置的<code>POSTGRES_*</code>变量<a href="https://github.com/docker-library/postgres/blob/5c0e796bb660f0ae42ae8bf084470f13417b8d63/11/stretch/docker-entrypoint.sh#L67" rel="nofollow noreferrer">Postgres will initialize the DB</a></p>
<p>之后,如果更改了其中一个变量,则需要通过<code>psql</code>或执行<code>docker-compose rm postgres; docker-compose up postgres</code>手动将它们重置为DB,以使用新变量重新创建DB</p>
<p>警告:<code>docker-compose rm postgres</code>将删除当前数据库</p>
<p><a href="https://stackoverflow.com/a/54232883/5274713">This answer</a>建议<code>docker-compose down -v</code>擦除您的卷</p>