Linking into a postgresql container

There is a project which I am trying to get running. One of its containers is a postgresql container. But when I run it(using docker-compose) I get an error which seems to be related to the database. So I thought I should get a look at the database itself from within postgresql environment inside the container. So naturally I tried to link into it using a bash container like below:

docker run --rm -it --net saleor_default --link database bash

where database is the container_name given to the database container in the docker-compose.yml file. But when the bash starts and I enter psql, the only thing I get is:

bash: psql: command not found

as if there is no postgresql installed in this container.
So what should I do?
Thanks

Did you build your own postgresql container? if you are using the official image in docker hub, psql should exist.

This is a project I cloned from github, and I think it uses the official image.
One of the services defined in the docker-compose.yml has postgres as its image, which I think is the official postgres image, isn’t it?

postgres would be the official image. but why you saw bash: psql: command not found? Did you enter the postgres container?

At first I ran the project using “docker-compose up”. Then I linked into it with a bash container with the command below:

docker run --rm -it --net saleor_default --link database bash

I gave the container_name “database” to the postgres container in the docker-compose.yml file.
After I ran this command, I got a bash shell.