Running Docker as Current User on MAC OS X

I am attempting to run a docker container as the current user on MAC OS X El Capitan version 10.11.6. I found the following command searching various forums but it still doesn’t work for me:

docker run -ti --rm -v /etc/group:/etc/group:ro -v /etc/passwd:/etc/passwd:ro -p 1521:1521 --user=$USER myimage

I receive an error stating there are no matching entries in the passwd file. I checked and the passwd file doesn’t contain a reference to my ID.

I need to run this container as my ID. Has anyone figured out how make this work on the MAC?

You don’t have the $USER created in the container.

build a image with such a user and the error will gone.

It looks like Mac doesn’t use /etc/passwd. The “standard” location for account info is DirectoryService