diff --git a/Dockerfile b/Dockerfile index 8100844..9170628 100644 --- a/Dockerfile +++ b/Dockerfile @@ -318,12 +318,6 @@ COPY --from=gosu /usr/local/bin/gosu /usr/local/bin/gosu COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh -# 在 entrypoint.sh 中 docker_init_database_dir 后添加修改 listen_addresses 的 sed 行 -RUN sed -i '/docker_init_database_dir/a\ -sed -i "s/^#*\\s*listen_addresses\\s*=.*/listen_addresses = '\''0.0.0.0'\''/" \"$PGDATA\"/postgresql.conf' \ - /usr/local/bin/docker-entrypoint.sh - - RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql COPY supervisord.conf ./etc/ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c8959f0..18ef906 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -339,6 +339,9 @@ _main() { ls /docker-entrypoint-initdb.d/ > /dev/null docker_init_database_dir + + sed -i "s/^#*\s*listen_addresses\s*=.*/listen_addresses = '0.0.0.0'/" "$PGDATA"/postgresql.conf + pg_setup_hba_conf "$@" # PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless