About
mount a file or directory of the host into a container.
- volume: mount a file or directory of the host machine into a container located at /var/lib/docker/volumes/
- Docker - Bind mount: mount a file or directory of the host machine into a container located where you want. It rely on the host machine’s filesystem having a specific directory structure available.
Bind mounts and volumes can both mounted into containers using the -v or –volume flag.
Articles Related
From your machine to the container
If you want to have the files of your machine on the host, you need to mount them on the host. See Shared drive configuration on Virtual Box
You can also use:
- the cp command to transfer file between your local file system and the container
- from the host: vim scp:remoteuser@containerippath/to/document
Bind Mount vs Volume
Bind mounts have limited functionality compared to volume. By contrast, when you use a volume, a new directory is created within Docker’s storage directory on the host machine, and Docker manages that directory’s contents.