MatchbookLab / local-persist

Create named local volumes that persist in the location(s) you want
MIT License
851 stars 122 forks source link

Cannot create container for service xxx permission denied #76

Open matt-lethargic opened 4 years ago

matt-lethargic commented 4 years ago

Whenever I try and use the local-persist I'm getting this error:

ERROR: for nodered  Cannot create container for service nodered: open /mnt/data/volumes/nodered/data: permission denied

ERROR: for nodered  Cannot create container for service nodered: open /mnt/data/volumes/nodered/data: permission denied
ERROR: Encountered errors while bringing up the project.

The permissions on this folder I've set to 777 to try and get rid of this error, but it still happens.

I'm creating my own docker image as part of my docker-compose file and I've event tried setting the folder inside the container to 777, but still no luck.

Where do I go from here?

I'm using sudo to spin up my docker.compose. I've used volume inspect and that gives no clues

    {
        "CreatedAt": "0001-01-01T00:00:00Z",
        "Driver": "local-persist",
        "Labels": {
            "com.docker.compose.project": "smarthome",
            "com.docker.compose.version": "1.23.2",
            "com.docker.compose.volume": "nodered-data"
        },
        "Mountpoint": "/mnt/data/volumes/nodered/data",
        "Name": "smarthome_nodered-data",
        "Options": {
            "mountpoint": "/mnt/data/volumes/nodered/data"
        },
        "Scope": "local"
    }
]

Any help would be great as I've been trying to get this to work for weeks now

CWSpear commented 4 years ago

What does your docker-compose.yml file(s) look like?

Is there any issue with the mount in general? Does mkdir -p /mnt/data/volumes/nodered/data and touch /mnt/data/volumes/nodered/data/test.txt work?

matt-lethargic commented 4 years ago

docker.compose.yaml

nodered:
  ...blah
  volumes:
      - nodered-data:/data

....

volumes:
  nodered-data:
    driver: local-persist
    driver_opts:
      mountpoint: /mnt/data/volumes/nodered/data

the folder /mnt/data/volumes/nodered/data/ I could touch a file into, owner root group smarthome mode 774 drwxrwxr

I deleted it and created it again and couldn't add empty file unless I used sudo

CWSpear commented 4 years ago

If you can't create files in a folder with 774 permissions without sudo, then something else is fishy...

matt-lethargic commented 4 years ago

sorry, you mis-understood me, that config was the setup before I deleted the directory and ran

mkdir -p /mnt/data/volumes/nodered/data and then touch /mnt/data/volumes/nodered/data/test.txt

it was then that this touch command didn't work. I have configured the permissions back to what i've written above now.

(total aside, I was buying Fish Pie when I read your reply, totally smelled fish!!)

matt-lethargic commented 4 years ago

No more thoughts? Anyone? :-(

CWSpear commented 4 years ago

I'm sorry, I don't.

I am still a little confused... you keep saying that creating a file (via touch) doesn't work, but then saying it does. When does it work and when does it not?