Let's start from a command:
docker run -v /Users/chiyuanye/play:/home/jovyan -p 8888:8888 jupyter/scipy-notebook
Is used to create a volume or bind mount.
docker run -v myvolume:/data myimage
This command creates a volumn named "myvolume" and maps it to the "/data" directory inside the container.
Any data written to "/data" from the container is persisted on the host machine under the "myvolume" directory.
docker run -v /path/on/host:/path/in/container myimage
This command maps the "/path/on/host" directory on the host machine to the "/path/in/container" directory inside the container.
Any changes made to files in "/path/on/host" or "/path/in/container" are reflected on both the host machine and the container.
In this example, the path "/Users/chiyuanye/play" on my machine will map to "/home/jovyan" in the container.
Is used to do the port mapping between host and docker container.
docker run -p 8080:80 [image_name]
This command tells Docker to map port 8080 on the host to port 80 inside the container.
Any traffic sent to port 8080 on the host will be forwarded to port 80 in the container.