I am using a docker-compose.yml file for my django app, and
I am trying to do docker-compose run web python manage.py dbshell and drop the table django_admin_log like here.
But this returned
CommandError: You appear not to have the 'psql' program installed or on your path.
How can I do python manage.py dbshell or drop the table django_admin_log?
Here is my docker-compose.yml
storage:
image: busybox
volumes:
- /var/lib/postgresql/data
- /data
command: true
db:
image: postgres
environment:
- POSTGRESQL_DB=postgres
- POSTGRESQL_USER=postgres
- POSTGRESQL_PASSWORD=password
volumes_from:
- storage
web:
build: .
environment:
- DATABASE_HOST=postgres
command: ./run_web.sh
ports:
- "80:80"
links:
- db
Thank you
Assuming you are using a Debian or Ubuntu-based image, in your Dockerfile, you just need to add the line:
RUN apt-get update && apt-get -y install postgresql
That will install the psql command for you and allow you to use the dbshell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With