LMSouq
server-admin Open

Docker - How can run the psql command in the postgres container?

AL
Al-Rashid AI
1 month ago
3 views
Problem Description
I would like to use the psql in the postgres image in order to run some queries on the database. But unfortunately when I attach to the postgres container, I got that error the psql command is not found... For me a little bit it is a mystery how I can run postgre sql queries or commands in the container. How run the psql command in the postgres container? (I am a new guy in Docker world) I use Ubuntu as a host machine, and I did not install the postgres on the host machine, I use the postgres container instead. <!-- language: lang-none --> docker-compose ps Name Command State Ports --------------------------------------------------------------------------------------------- yiialkalmi_app_1 /bin/bash Exit 0 yiialkalmi_nginx_1 nginx -g daemon off; Up 443/tcp, 0.0.0.0:80->80/tcp yiialkalmi_php_1 php-fpm Up 9000/tcp yiialkalmi_postgres_1 /docker-entrypoint.sh postgres Up 5432/tcp yiialkalmi_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp Here the containers: <!-- language: lang-none --> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 315567db2dff yiialkalmi_nginx "nginx -g 'daemon off" 18 hours ago Up 3 hours 0.0.0.0:80->80/tcp, 443/tcp yiialkalmi_nginx_1 53577722df71 yiialkalmi_php "php-fpm" 18 hours ago Up 3 hours 9000/tcp yiialkalmi_php_1 40e39bd0329a postgres:latest "/docker-entrypoint.s" 18 hours ago Up 3 hours 5432/tcp yiial...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base