"psql: command not found" when running build



As part of the build I am loading a .sql file into the PG database.

When I tried converting to CircleCI 2.0 this proved to be a problem because I get the error psql: command not found when trying to run the build, presumably because the command is running inside the Ruby container but Postgres is installed in the other container.

How do I work around this?


You are right, only first container on a list expose all the environment and should have psql.
We build a custom image for ourselves which, something like:

FROM library/ruby

# required for base container
RUN -xe apt-get -y update && apt-get install git ssh

# client 
RUN -xe apt-get -y update && apt-get install --no-install-recommends -y postgresql-client-9.6


The ruby image already has headers for postgres (libpq-dev) because it is able to compile the pg gem.

Would be great if it also could have the client tools of the same version. The sql schema is in rails and required for some advanced database schemas.


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