Skip to content

Permission denied when mounting the redis data dir and enabling persistence #233

Closed
@oreoluwa

Description

@oreoluwa

Hi,
For about a week now, I've been unable to mount the /data dir as I keep getting a permission error.
When the data dir isn't mounted, everything works perfectly.

$ docker run -it --rm -v $PWD/redis:/data redis redis-server --appendonly yes
1:C 05 Apr 2020 02:57:46.684 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 05 Apr 2020 02:57:46.684 # Redis version=5.0.8, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 05 Apr 2020 02:57:46.685 # Configuration loaded
1:M 05 Apr 2020 02:57:46.686 # Can't open the append-only file: Permission denied

The workaround I've been using is:

$ docker run -it --rm -v $PWD/redis:/data redis sh -c 'redis-server --appendonly yes'
7:C 05 Apr 2020 03:03:58.246 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7:C 05 Apr 2020 03:03:58.246 # Redis version=5.0.8, bits=64, commit=00000000, modified=0, pid=7, just started
7:C 05 Apr 2020 03:03:58.247 # Configuration loaded
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 5.0.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 7
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

7:M 05 Apr 2020 03:03:58.255 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7:M 05 Apr 2020 03:03:58.255 # Server initialized
7:M 05 Apr 2020 03:03:58.256 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7:M 05 Apr 2020 03:03:58.388 * DB loaded from append only file: 0.132 seconds
7:M 05 Apr 2020 03:03:58.388 * Ready to accept connections

Environments:
Machine Macbook Pro (MacOS 10.15.4)
Docker Toolbox (with Virtualbox)
docker-machine version 0.16.1, build cce350d7
Client: Docker Engine - Community
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:18:17 2019
OS/Arch: darwin/amd64
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.12)
Go version: go1.12.12
Git commit: 633a0ea838
Built: Wed Nov 13 07:28:45 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions