# Is it possible to login into the postgres database inside the docker image?

**URL:** <https://meta.discourse.org/t/is-it-possible-to-login-into-the-postgres-database-inside-the-docker-image/35167>\
**Category:** Self-hosting\
**Created:** [November 2, 2015, 12:48am UTC](https://meta.discourse.org/t/is-it-possible-to-login-into-the-postgres-database-inside-the-docker-image/35167 "2015-11-02T00:48:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [July 13, 2016, 8:14am UTC](https://meta.discourse.org/t/is-it-possible-to-login-into-the-postgres-database-inside-the-docker-image/35167/6 "2016-07-13T08:14:39Z")

</div>

Amplifying on this, some basic postgres commands once you have the postgres command line in the container:

list all databases  
`\l`

select a database  
`\c dbname`

list tables in the current database  
`\dt`

list columns in the users table  
`\d+ users`

number of rows in the users table  
`select count(*) from users;`

display value of configuration variables  
`show shared_buffers;`

exit from the postgres console  
`\q`

If you know SQL I am sure you can take it from here 😉 note that all SQL **must** terminate with semicolon `;`

Also, [some queries to identify largest tables](https://wiki.postgresql.org/wiki/Disk_Usage).

---

_[View the full topic](https://meta.discourse.org/t/is-it-possible-to-login-into-the-postgres-database-inside-the-docker-image/35167)._
