I am trying to use Mark Shust's repo to install Magento 2 with Docker.

For some strange reason, I am getting this error: Error I tried all the answers here.

For more details: https://github.com/markoshust/magento-docker/issues/80

Would really appreciate some help.


I am logged in as root and have tried all variations of chmod -R 777 var. The files that refuse to change ownership are all from /var/www/html/var/composer_home/.

Here are current permissions for folder:

total 40
-rwxrwxrwx 1 app  app    189 Jan 16 18:44 auth.json
drwxr-xr-x 6 root root   192 Aug 31 19:57 cache
-rwxrwxrwx 1 app  app     63 Sep  4 22:14 composer.json
-rw-r--r-- 1 root root 21034 Sep  4 22:03 composer.lock
-rwxrwxrwx 1 app  app    799 Sep  4 18:10 keys.dev.pub
-rwxrwxrwx 1 app  app    799 Sep  4 18:10 keys.tags.pub
drwxr-xr-x 9 root root   288 Sep  4 22:14 vendor

Sample error:

chown: changing ownership of '/var/www/html/var/composer_home/.htaccess': Operation not permitted

2 Answers 2


Try running these commands to remove and recreate the folders.

Out of the container:

sudo rm -rf ./var/composer_home ./composer.lock ./vendor

Inside the container:

mkdir /var/www/html/vendor/
composer install

If Permissions Keep Resetting

Add to ./bin/fixperms

./bin/cli find var vendor pub/static pub/media app/etc -type f -exec chmod g+s {} \;
./bin/cli find var vendor pub/static pub/media app/etc -type d -exec chmod g+s {} \;


  • I removed ./bin/fixperms from setup because it didn't recognize my file structure. Then I did chown -R app:app for anything that required permissions that Magento requested Jan 17, 2018 at 16:07
  • Mistake - ./bin/fixperms on a new installation is working Jan 18, 2018 at 17:33

Generally there can be 2 possibilities:

  1. The /var folder doesn't have correct permissions - they should be 755

  2. The /var folder doesn't have the correct ownership - should be the Magento file system owner

So you should just check the permission and ownership on that folder and change the one that's causing this problem.

  • I cannot change current ownership of anything in /var/www/html/var/composer_home. I get an error that 'Operation not permitted'. I am the root user and attempting to give app:app ownership. Jan 16, 2018 at 21:31
  • Connect via CLI and user this command: sudo chown -r app:app /var/www/html/var/ - this should change the ownership and group of that folder and all files within it to the app user.
    – Lez
    Jan 16, 2018 at 21:43
  • Still getting error, sudo doesn't work for me. Could be because my shell is root@a239efb26839:/var/www/html# , but do I need it? Jan 16, 2018 at 21:47
  • Not sure then...as the root user, you should be able to change all permissions and ownerships. Unless something messed up your root user... Make sure you really are logged in as root and not as app user while trying.
    – Lez
    Jan 16, 2018 at 21:59
  • You don't need sudo if you're logged in as root.
    – Lez
    Jan 16, 2018 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.