Docker Community Forums

Share and learn in the Docker community.

Permission issue with wordpress, docker, bind volume and nfs server

Hi everyone:
I’m having some permission issues with a WordPress environment.
Docker host is an Ubuntu 18.04 and the NFS server is the same, i’m using Docker CE.
I have a bind volume that is pointing to a local folder (this local folder is a mounted folder from a NFS server), in order to make WordPress to work(upload images, write logs or files) i had to grant 777 to that folder on the NFS server, of course i’m not comfortable with this, but i couldn’t find any other solution yet.

This is an image with the infrastructure setup.
Untitled Diagram

Also this is my docker-compose
web:
build:
context: .
dockerfile: Dockerfile-local
volumes:
- type: bind
source: ./
target: /var/www/html/
Ok i think that’s all. Thanks a lot

Hopefully this will help: https://stackoverflow.com/questions/39922161/mounting-nfs-shares-inside-docker-container

Don’t focus too much on the top answer. I belive the second an third would be more interesting to you

1 Like

curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-dokuwiki/master/docker-compose.yml > docker-compose.yml
Modified ports (see below)
Modified volumes (see below)
docker-compose up -d
ports:
- ‘8050:80’
- ‘8051:443’
volumes:
- ‘/mnt/titan/docker/dokuwiki/data:/bitnami’

1 Like

Make sure to match the UID:GID of the owner of your nfs share the same UID:GID used inside the container to run wordpress.

And as mgabeldocker suggested: use a volume instead of bind-mounts. If the nfs share becomes stale, the container will remedy the problem byitself. If the nfs mount on the host becomes stale things usualy get weird.

1 Like