rails master.key permission error when docker-compose build


error

db uses an image, skipping
Building web
Traceback (most recent call last):
  File "site-packages/docker/utils/build.py", line 96, in create_archive
PermissionError: [Errno 13] Permission denied: '/app_dir/config/master.key'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 127, in perform_command
  File "compose/cli/main.py", line 287, in build
  File "compose/project.py", line 386, in build
  File "compose/project.py", line 368, in build_service
  File "compose/service.py", line 1084, in build
  File "site-packages/docker/api/build.py", line 159, in build
  File "site-packages/docker/utils/build.py", line 31, in tar
  File "site-packages/docker/utils/build.py", line 100, in create_archive
OSError: Can not read file in context: /app_dir/config/master.key
[25563] Failed to execute script docker-compose

solution

sudo chmod 644 /app_dir/config/master.key