Create docker volume device/host path
Docker recommends creating volumes in the default location. However, designating location will be easy for data transferring. Especially, dockers for internal use will not be exposed to the public, and thus security is not a big issue.
A couple options:
Copy into container
1 | docker cp /path/of/the/file <Container_ID>:/path/of/he/container/folder |
Not a persistent way, because of no volumes involved
Attach a directory as volume
Create
1 | docker volume create --name my_test_volume --opt type=none --opt device=/home/../Test_volume --opt o=bind |
Mount
1 | docker run -d \ |
The two steps are actually modifying the container yaml file and compose it.
1 | version: '3' |
1 | docker-compose up -d |