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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…