N8n with docker does not recognize command pg_dump in command line

Hello, I have installed postgresql-client on my host machine to use pg_dump command. From the host terminal I can run the commands I need normally.
But using n8n command line node gives error, returned pg_dump: not found message.

PS: Previously I used n8n with npm, and the commands worked as well. Now I migrated to docker, and the commands are not recognized.

Information on your n8n setup

  • n8n version: 2.14
  • Database you’re using: Postgresql
  • Running n8n via: Docker

Hi @Rodrigo_Pereira, welcome to the community!

Are you trying to use pg_dump inside your n8n workflow (using the Execute Command node)? This would fail because your docker container can’t access stuff living on your host machine by default and n8n itself does not come with pg_dump.

From looking at this related discussion it seems pg_dump is now available as part of the postgresql-client package in Alpine Linux (on which the standard n8n docker is built upon). So you should be able to build your own n8n docker image (for example as described here) and add a apk add --no-cache postgresql-client line to the respective Dockerfile.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.