Docker Community Forums

Share and learn in the Docker community.

File permissions on Local Volumes


(Lmartins) #1

Im running the official WordPress container for local development, and have it mapped to a local folder on my host machine. Everything runs fine except WordPress can’t write any files as it has no permissions as far as I can tell.

I’ve even tried adding 777 permissions to the uploads folder, it then creates the first folder but it goes to try adding another it fails again.

Is there any way I can get around this?


(Ducatel David) #2

Strange, give me your (minimal please) docker run line (or docker compose.yml)


(Lmartins) #3

Apparently this is due to the way Apache runs. Im now running another container which runs ngnx and it runs fine.
It would be go to know if theres a way to do it nonetheless.

Heres my composer config:

webipackdev:
  image: gravityrail/wordpress
  volumes:
    - src:/var/www/html
  links:
    - db:mysql
  ports:
    - 80:80

db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: password

(Ducatel David) #4

If you have a work around, I will no search a lot :smiley:

So I think apache run with an user (like www-data) which doesn’t have write right on your data folder (inside the container).
Maybe if you chown your data folder to apache user, it can then write on this folder.


(Lmartins) #5

Thank you David.
Yes, Im quite happy with my setup at the moment. :smiley: