Error: I have no name! occurs when trying to run ~$ sudo docker run --volume

Regarding the “I have no name!” username prompt: a container uses an isolated filesystem. It is not aware of any existing users of your host system.

You have two options here:
– To make the container aware of the host’s users, you can use -v /etc/passwd:/etc/passwd:ro to mount it read only into the container (less favored approach, except there are reasons like with the postgres image)
– You create a user while creating the image: add RUN useradd -u {your UID} -g {your GID} -m {whatever username you want to see instead of "I have no username!"} to your Dockerfile. Then set the USER {whatever username you want to see instead of "I have no username!"} instruction in the Dockerfile (after useradd). -u will modify the first user declared in a USER instruction.