Docker Data volumes
While
mounting a host’s data volume to a container, I could not find the folder/files
inside the folders.
$ ls /www/html
index.html
$ docker run
-d -P -v "$(pwd)/www":/app:ro apache2-webserver /bin/bash
root@xxxx:/app#
ls
root@xxxx:/app#
Here is my way to solve it,
1.
Change host’s absolute
path to relative path
2.
Update the settings of VM to allow sharing certain drives
or directories to Docker.
After
did so, it works like a charm.
$ ls /www/html
index.html
$ docker run
-d -P -v "/www":/app:ro apache2-webserver /bin/bash
root@xxxx:/app#
ls
html
root@xxxx:/app#
ls html
index.html
▌Reference
沒有留言:
張貼留言