Docker cannot write to assets folder as web server process in Yii/PHP application locally OS X

appreciate if you could help me.

I’m running docker VM in a MAC OS X and seems okay until i reach a permissions error when my app is trying to write files in the assets folder in the server:

  • Docker: Unable to find volume real location
  • Jenkins docker pipeline error
  • Managing mysql users in a Docker environment
  • Can't connect to Cassandra Docker Container
  • Cannot install gems from git in dockerized rails app
  • Google Magenta (muisc/ML) docker image for running with GPU?
  • CAssetManager.basePath "/var/www/html/assets" is invalid. Please make sure the directory exists and is writable by the Web server process.

    I ran ls -l in the docker container shell ($ docker exec container) and saw that my folder permissions are set to
    drwxrwxrwx 1000 staff assets. Following that, i tried to set it to www-data as i though it might work , so i ran usermod -u 1000 www-data. Now folder becomes: drwxrwxrwx www-data staff assets but the error persists.

    In the shell, I also tried to run chmod and chown commands but i get these errors:

    chown: changing ownership of 'assets': Read-only file system

    chmod: changing ownership of 'assets': Read-only file system

    How can i enable my directory to be writable by the web server process in docker?


    $ docker ps returns

    enter image description here

    $ docker info## Heading ## returns

    enter image description here

    UPDATE 2:
    $ docker inspect returns

  • How to deploy a Docker container on EC2 ECS from Docker Hub private repo?
  • How do I get host networking to work with docker swarm mode
  • How to remote debug python code in a Docker Container with VS Code
  • Docker: mounting volume and run node apps
  • Jenkins, Docker Build Step create container issue
  • Docker Unable to find image '502:20' locally. How can I resolve this issue?
  • 2 Solutions collect form web for “Docker cannot write to assets folder as web server process in Yii/PHP application locally OS X”

    Looking at the docker inspect output

            "Mounts": [
                "Source": "/Users/joelkoh/Sites/merrymaker/php-app",
                "Destination": "/var/www/html",
                "Mode": "ro",
                "RW": false,
                "Propagation": "rprivate"

    It looks like your directory is read only, I’m not familiar with elastic beanstalk, but you will need to change that volume so it isn’t read only.

    You might consider using for mounting shares. Since it is not mounting, but syncing, it solved the user permission-problems by mapping your desired uid/guid to the container

    This way you have a very performant share, but also, having a proper user mapping to never care about permission issues in the container ( for host-mounted folders )

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.