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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With