psql 和 postgresql-client 有什么区别?
What is the difference between psql and postgresql-client?
我可以访问不同主机上的两个 postgres 数据库服务器。在服务器 A 上,我使用以下方式访问客户端:
psql -h localhost -U user -W db_name
db_name=>
在第二台主机 B 上,我使用(docker 图片)访问客户端:
docker run -it --rm --network fiware_default jbergknoff/postgresql-client\
postgresql://postgres:password@postgres-db:5432/postgres
postgres=#
现在我需要转储从 A 复制的数据库文件(现在在 B 上)使用:
psql -U postgres -d targetdb -f sourcedb.sql
但是,第二个主机 B 无法识别命令 psql
。我的意思是我无法使用 psql
B
运行 命令
请问这里的psql
和postgres-client
有什么区别?
docker 图像 postgresql-client 已将 psql
定义为入口点。参见 https://github.com/jbergknoff/Dockerfile/blob/master/postgresql-client/Dockerfile#L3。
所以你基本上 运行 psql psql
而 psql 不明白这一点。只需离开 psql
并直接从 args 开始。
您可以在此处阅读 CMD 与 ENTRYPOINT 的对比 What is the difference between CMD and ENTRYPOINT in a Dockerfile? or here http://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/。
我可以访问不同主机上的两个 postgres 数据库服务器。在服务器 A 上,我使用以下方式访问客户端:
psql -h localhost -U user -W db_name
db_name=>
在第二台主机 B 上,我使用(docker 图片)访问客户端:
docker run -it --rm --network fiware_default jbergknoff/postgresql-client\
postgresql://postgres:password@postgres-db:5432/postgres
postgres=#
现在我需要转储从 A 复制的数据库文件(现在在 B 上)使用:
psql -U postgres -d targetdb -f sourcedb.sql
但是,第二个主机 B 无法识别命令 psql
。我的意思是我无法使用 psql
B
请问这里的psql
和postgres-client
有什么区别?
docker 图像 postgresql-client 已将 psql
定义为入口点。参见 https://github.com/jbergknoff/Dockerfile/blob/master/postgresql-client/Dockerfile#L3。
所以你基本上 运行 psql psql
而 psql 不明白这一点。只需离开 psql
并直接从 args 开始。
您可以在此处阅读 CMD 与 ENTRYPOINT 的对比 What is the difference between CMD and ENTRYPOINT in a Dockerfile? or here http://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/。