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:

  • IBM Bluemix Containers : cf ic stats not working
  • RabbitMQ on Docker: Pika hangs on connection when given port, connection refused without port
  • Docker compose and REST config
  • Cannot publish any docker containers
  • Docker image creation exception: “This archives contains unclosed entries”
  • How to run docker images (nodejs server) without exiting
  • 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

  • Docker swarm specific signal when down-scale replication number
  • How to set Docker ENTRYPOINT To NPM?
  • Error “No module named MySQLdb” on docker
  • What does it mean to attach a tty/std-in-out to dockers or lxc?
  • Service ports not visible in overlay network across hosts using docker swarm mode
  • Docker service does not start
  • 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.