Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
144 views
in Technique[技术] by (71.8m points)

Command for loading postgres through docker?

Does anyone know the command for loading postgres through docker? Here is the recommended command on their documentation:

docker run -it --rm --network some-network postgres psql -h some-postgres -U postgres

Forgive the naive question, how do you find what values for "some-network" are supposed to be and what values "some-postgres" is supposed to be?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To be precise, each flag has a own meaning in the docker run command.

docker run -it --rm --network some-network postgres psql -h some-postgres -U postgres

-i: Keep STDIN open even if not attached

-t: Allocate a pseudo-TTY

--rm: Automatically remove the container when it exits

--network: Connect a container to a network. You can ignore this if you are running a standalone postgress container or you can use host mode if you want the container to use host networking. For more information and modes. Check below article.

Ref:- https://docs.docker.com/network/

psql -h some-postgres -U postgres : Final command you are passing to postgres


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...