Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing permissions #67

Closed
sk1ter opened this issue Nov 14, 2019 · 10 comments
Closed

Writing permissions #67

sk1ter opened this issue Nov 14, 2019 · 10 comments

Comments

@sk1ter
Copy link

sk1ter commented Nov 14, 2019

I have a problem with write permission on /var/www/html directory.

Warning: file_put_contents(aaa.txt): failed to open stream: Permission denied in /var/www/html/index.php on line 69

How can I fix it?

@MrOffline77
Copy link
Collaborator

Are you using windows or Ubuntu ? Which PHP version do you use ?

@sk1ter
Copy link
Author

sk1ter commented Dec 14, 2019

Hi! I am using Ubuntu 18.04, Docker version 18.09.7 build 2d0083d

@MrOffline77
Copy link
Collaborator

@javlonbek-sharipov this sound like #41 does the steps there help you with your problem ?

@wi1w
Copy link

wi1w commented Feb 8, 2020

You can try pass rw permissions to container.

webserver:
    build: 
      context: ./bin/webserver
    container_name: 'png-webserver'
    restart: 'always'
    ports:
      - "80:80"
      - "443:443"
    links: 
      - mysql
    volumes: 
      - ${DOCUMENT_ROOT-./www}:/var/www/html:rw
      - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
      - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
      - ${LOG_DIR-./logs/apache2}:/var/log/apache2

Try modify files volume with :rw

Reply if helps

@bugzbrown
Copy link

You can try pass rw permissions to container.

webserver:
    build: 
      context: ./bin/webserver
    container_name: 'png-webserver'
    restart: 'always'
    ports:
      - "80:80"
      - "443:443"
    links: 
      - mysql
    volumes: 
      - ${DOCUMENT_ROOT-./www}:/var/www/html:rw
      - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
      - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
      - ${LOG_DIR-./logs/apache2}:/var/log/apache2

Try modify files volume with :rw

Reply if helps

Just so you know... adding rw worked in an ubuntu distro.

@sk1ter
Copy link
Author

sk1ter commented Feb 22, 2020

@wi1w thanks!

@jagad89
Copy link

jagad89 commented Sep 24, 2020

You can try pass rw permissions to container.

webserver:
    build: 
      context: ./bin/webserver
    container_name: 'png-webserver'
    restart: 'always'
    ports:
      - "80:80"
      - "443:443"
    links: 
      - mysql
    volumes: 
      - ${DOCUMENT_ROOT-./www}:/var/www/html:rw
      - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
      - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
      - ${LOG_DIR-./logs/apache2}:/var/log/apache2

Try modify files volume with :rw

Reply if helps

This solve basic file operations problem.
But when I did git pull within the container, the newly updated files are not writable anymore. Is there any quick solution for that?

@MahbbRah
Copy link

Docker Windows 10 WSL backend, updated file/folder permission but still the issue exists.

@smilemittal
Copy link

Having same issue using php8 and php74

@alainseys
Copy link

Docker Windows 10 WSL backend, updated file/folder permission but still the issue exists.

do you run your docker daemon inside a wsl linux container or on the machine its self ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants