无法通过bash脚本创建postgres扩展

无法通过bash脚本创建postgres扩展,bash,postgresql,docker,postgresql-9.3,Bash,Postgresql,Docker,Postgresql 9.3,在docker容器中启动了postgres db,并希望随后使用以下脚本安装扩展: su postgres sh -c "psql -U postgres <<EOSQL CREATE EXTENSION hstore; CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology; CREATE EXTENSION fuzzystrmatch; EOSQL" trap "echo \"Sending SIGTERM to

在docker容器中启动了postgres db,并希望随后使用以下脚本安装扩展:

su postgres sh -c "psql -U postgres <<EOSQL
CREATE EXTENSION hstore;
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION fuzzystrmatch;
EOSQL"

trap "echo \"Sending SIGTERM to postgres\"; killall -s SIGTERM postgres" SIGTERM

su postgres sh -c "$POSTGRES -D $DATADIR -c config_file=$CONF" &
wait $!
并在cli中按顺序运行以下命令

su postgres
psql -U postgres
create extension hstore;
然后我可以从pgAdmin中看到hstore已成功安装

su postgres
psql -U postgres
create extension hstore;