6

I have postgres container and a ruby container. When running docker-compose run web rake db:migrate I got an error like this

rake aborted!
failed to execute:
pg_dump -s -x -O -f /usr/src/app/db/structure.sql --schema=public --schema=partitioning docker_rails_dev

Please check the output above for any errors and make sure that `pg_dump` is installed in your PATH and has proper permissions.

/usr/local/bundle/gems/activerecord-4.2.7.1/lib/active_record/tasks/postgresql_database_tasks.rb:90:in `run_cmd'
/usr/local/bundle/gems/activerecord-4.2.7.1/lib/active_record/tasks/postgresql_database_tasks.rb:55:in `structure_dump'
/usr/local/bundle/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:183:in `structure_dump'
/usr/local/bundle/gems/activerecord-4.2.7.1/lib/active_record/railties/databases.rake:279:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/activerecord-4.2.7.1/lib/active_record/railties/databases.rake:53:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/activerecord-4.2.7.1/lib/active_record/railties/databases.rake:45:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:structure:dump
(See full trace by running task with --trace)

The pg_dump command is available in the postgres container but not in ruby container but I have linked them together in my docker-compose.yml file.

2 Answers 2

14

If you don't actually want the dump (why would you in CI?) put this in your test.rb:

config.active_record.dump_schema_after_migration = false

Now, no more need for PG tools (besides the client driver) in the ruby container.

Sign up to request clarification or add additional context in comments.

Comments

0

Short answer: Install the tools you need -inside- the container, -inside- the container.

If you need pg_dump running inside the ruby container, install postgress in the ruby container. Binaries are rarely portable in that way.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.