I’m looking for a Docker image that would only have all the necessary components to make calls to an external Postgres database using the psql
client in the shell. I do not need to launch a database locally or anything.
I found jbergknoff/postgresql-client, which I haven’t tested, but I’m just mostly surprised there doesn’t seem to be any official image for that.
For now I’m using postgres:12-alpine
, but it’s only as part of a CronJob launched in Kubernetes which takes care of triggering a clean up of certain tables every once in a while by calling a Postgres function.
Anyone has something to recommend? Or some insight to share?
2
Answers
IMHO, It’s actually better to create our own Docker image instead of relying on some third party for such trivial need.
Supply chain security is already tricky enough.
Here is the content of my docker file
PgClientDockerfile
:Here is an excerpt from my
docker-compose.yml
:I have an
.env
file with values like:And here is an example usage (for my use case):
I created an image for the exact purpose, only have the psql client. Here is the image on DockerHub
https://hub.docker.com/r/codingpuss/postgres-client
Simply create a container
Then execute the command as you like: