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-compose: postgres data not persisting
  • Where does Travis CI put my source files?
  • How to list the published container images in the Google Container Registry using gcloud or another CLI
  • docker - network configuration to isolate two containers
  • Docker Pull Output Weird
  • Docker try to download unnecessary busybox image on creation of redis pod with kubernetes tools
  • 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

  • Node.js tcp sockets + linked Docker containers
  • Rebuild same docker image with only the additional changes in the Dockerfile
  • Git clone via HTTPS not working in Docker makefile
  • Starting vncserver using supervisord inside a Linux container
  • I tried to set up Kubernetes executor for gitlab but I get ERROR
  • How to setup docker to use cache from registry on every build step
  • 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.