I have installed Magento 2 while also playing with Docker dev environment. I have a problem logging into Magento2 admin panel.

After I enter the correct username and password, I am being redirected back to the login screen, but the URL changes to http://magento2.dev.local/admin_m11a7k/admin/dashboard/index/key/2481eca5d84c964ff31e222ca50c85d68593dfbbf0ed086af8082bd5c8c6a932/

var/session looks like this after trying to log in:

-rw------- 1 wjarka www-data 0 5 lis 17:52 sess_125312a61b14e31b5d0857a1e30b80d2

-rw------- 1 wjarka www-data 0 5 lis 17:52 sess_feb318bcf09cf6fc012e37ac72813f46

Session files are empty, so I guess this is some kind permissions problem? Looks like it's creating the files in a way that it's not able to read it later? It probably should be www-data:www-data, right? And for some reason it uses wjarka:www-data.

PHP-FPM runs as www-data, so that's... weird. Anything I might be missing?

I am using Docker containers for php 5.6-fpm and apache 2.4 from official repos.

UPDATE #1 It seems like I know a workaround, but I am still looking for a permanent fix.

Based on this: https://github.com/magento/magento2-docker/blob/master/etc/php-fpm.conf/www.conf

I have moved the session storage to a directory owned by www-data and that is in the container (and not shared through NFS). That worked just fine!

Then I tried to create a new dir on my local filesystem that would be owned by www-data:www-data (33:33). And share my local dir with the docker container in the new path. And then it fails.

So it seems like NFS sharing is messing it up.

1 Answer 1


Are you using usermod in your Dockerfile? This maps your host username (uid 501/1000) to use it as www-data in the Docker container.


RUN usermod -u 501 www-data


RUN usermod -u 1000 www-data
  • I used it before. As far as I remember, while debugging, I tried to run this through docker exec and restart the container. Will check again when I get to my laptop. Commented Nov 7, 2015 at 12:30
  • Thanks for pointing me in the right direction. Reenabled it and it works. Lesson learnt ;) Commented Nov 7, 2015 at 14:19

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.