I am writing a microservice application which has a docker container for postgres database. I know that when dumping SQL to database, we use this docker command in terminal:
cat <dump sql file> | docker exec -i <container ID> psql -U <postgres username> <database name>
I was wondering if there is a similar linux terminal docker command that i can run from outside the container to:
Create database named
Drop database named
Or even:
- Delete all tables of the to make it completely empty in one command.
Note that i should be able to run the docker command from outside the container through the host OS terminal (linux).
Any suggestions will be appreciated. Thanks in advance.