Docker machine files and folders

Hi everyone
Im new in docker

Im been playing around with docker machine and i face some issue and i need someone to explain me.

I made a docker machine with default name in virtualbox driver

And i use : eval $(docker-machine env default)
After that i used ~/dir1 and then run a docker command: docker run -it -v $PWD:/app composer init

But no file has been created in ~/dir1 after more than 2 hours and try alllll the volumes :smile: i exit the docker machine : eval $(docker-machine env -u)

And run the same docker run as i mentioned above and the file created on ~/dir1

Now i need to know why files and folders are different in docker machine and

How i can use my local folder when i am in docker machine , i mean i want when im in a directory in my terminal ( in my local ) and using docker machine , docker machine use my local directory to save or edit files.

Sorry for bad english or bad explanation.

Thank you guys