"As Török said, probably you need to rename emacs to init.el.
One thing that drove me crazy for a while is that if ~/.emacs exists then emacs doesn't load ~/.emacs.d/init.el. So, if you have a ~/.emacs either delete it and move its contents into the other file, or (load ""~/.emacs.d/init.el"") inside ~/.emacs."
"I had this problem too, when switching into a container.
It turned out, that the environment wasn't set up properly, and the USER and HOME variable still pointed to the root user, even though I was logged in as my working user.
Doing a su - <username> fixed it, because now the environment was initialized as expected."