为什么“安装postgresql”不能在docker容器中工作?

我正在使用Ubuntu容器作为一些软件的清洁开发环境。 我不知道为什么我可以在主机上安装postgresql,但在容器中遇到错误。 postgres更改为mysql时发生类似的事情。 我想它说它无法find/var/run的套接字文件。

 (in host) $ docker run -it ubuntu (in container) $ apt update && apt upgrade $ apt install postgresql $ psql psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? 

 $ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)