Docker Community Forums

Share and learn in the Docker community.

PermissionError: [Errno 13] Permission denied: '/home/fred/docker/tmp/db'

I have just installed Docker and I am trying to setup an application server based on Ruby on Rails. These are my first steps with Docker!

Following Compose’s tutorial for Rails, I configured and run containers creation:

docker-compose run web rails new . --force --no-deps --database=postgresql

It runs, fails and then returns:

PermissionError: [Errno 13] Permission denied: ‘/home/fred/docker/tmp/db’

Apparently, the run tries to perform an action on the docker/tmp/db folder, which is owned by systemd-coredump:root while tmp is owned by root:root

Did I make something wrong when installing with sudo ?
How can I solve this?

The first step would be sharing the complete docker-compose.yml - please only redact url, tokens or password and keep everything else untouched.

I am following this tutorial:
The docker-compose file is the one listed as example:

version: ‘3’
image: postgres
- ./tmp/db:/var/lib/postgresql/data
build: .
command: bash -c “rm -f tmp/pids/ && bundle exec rails s -p 3000 -b ‘’”
- .:/myapp
- “3000:3000”
- db

Then if I change the owner of created folders:

sudo chown -R $USER:$USER .

and then re-run the build, it ends correctly.
As explained in the tutorial, this is probably because Docker runs as root…

1 Like