1

I'm running a rails app on docker-compose image. After I created a user devise, when I run docker-compose run web rails db:migrate it shows the following error: PG::ConnectionBad: FATAL: could not open relation mapping file "global/pg_filenode.map": Permission denied

I have tried all the solutions rails and psql related, so I'm guessing my problem is with the docker-compose program somehow, I also tried with sudo but the result is the same

Code: The command I run is docker-compose run web rails db:migrate after docker-compose run web rails g devise usuario

and this is the output:

rails aborted!
PG::ConnectionBad: FATAL:  could not open relation mapping file "global/pg_filenode.map": Permission denied
/usr/local/bundle/gems/pg-1.1.4/lib/pg.rb:56:in `initialize'
/usr/local/bundle/gems/pg-1.1.4/lib/pg.rb:56:in `new'
/usr/local/bundle/gems/pg-1.1.4/lib/pg.rb:56:in `connect'

Rest of the log in this link: https://hastebin.com/axiboxohem.bash

gramsch
  • 379
  • 1
  • 5
  • 18

3 Answers3

8

It turned out that somehow there were multiple containers of the same image on Docker. I could see the extra containers mounted with docker ps -a -q, and removed them with docker rm $(docker ps -a -q). That did it for me, I guess one of the containers was holding to the file.

gramsch
  • 379
  • 1
  • 5
  • 18
1

your problem seems to be just in the connection with Postgresql, check out your postgres service is up or if you have the right permission in the folder. Look this, maybe help: Postgres is failing with 'could not open relation mapping file "global/pg_filenode.map" '

0

Run docker stop $(docker ps -q) to stop all running containers and try again.

Tsutomu
  • 4,848
  • 1
  • 46
  • 68