I am new to docker. Learning it from a book called Learn Fundamentals of Docker 18.x From Packt Publishing. In the chapter on Docker Volume the author creates a vm using docker-machine and then creates a volume called my-data. I have executed the commands as below in first terminal window:
Then the author creates a container mounting that volume using -v command. I have executed the commands as below in a second terminal window):
When I try listing the files in that volume back in my first terminal window I get nothing.
So my understanding was
- Create volume in docker.
- Mount the volume in a container.
- Create some data.
- Exit the container. And the data will be present.
I also notice that the docker volume inspect my-data provides different mount points:
By this I understand they are different volumes, right?
But I am not seeing any data in the volume. Is my understanding correct? Can anybody explain to me how volumes in docker work?
Also I would like to know how do I navigate to this location from my Mac terminal?
Thanks in advance.



