php - Specify umask in Dockerfile -


i'm using mac os , i'm trying set development environment docker. docker seems nice, i'm facing following problem:

problem:

whenever php (in docker container) creating folder subfolder, apache results in 500-error. apache-log: "... can't create directory app/../../folder/subfolder/subsubfolder/"

i assume caused environment variable umask, because whenever folder created, doesn't have write permission. because of subfolders can't created , on.

to test out, wrote little test-script (umask-test.php):

$umask = umask(0); echo ("umask = $umask <br>"); 

and bingo! every time build , run container , start script via browser, result is:

umask = 18 

goal:

so have umask set 000 (zero)

i figured out, best place set variable dockerfile, in dockerfile stated following:

from ubuntu:trusty ... env umask 0 ... 

problem is, results in nothing:

  • the test-script gives out 18 umask
  • folders still created wrong permission
  • subfolders can't created.

questions:

what doing wrong?

how can umask in docker containers set zero?

how can permit apache-user (www-data) create folders have write-permissions , in subfolders can created?

problem solved

since helpful other, want provide answer own question:

the problem not docker , umask-settings in container. problem mac , umask-setting on mac os!!

example: if umask on mac set 022, folders created on mounted directories docker have permissions 755. causes, no subfolders can created.

this link providing information how set umask mac: https://support.apple.com/en-us/ht201684

so if type in terminal

 sudo launchctl config user umask 000 

and reboot, folders created 777-permissions. including folders mounted docker.

before asking myself why running containers (initialized run -v ...) not working. seems work right! :-)


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -