On the persistence of docker Directory

I have a question about docker file persistence that I"d like to ask you guys

now I"ve created a docker container for host directory mapping

clipboard.png

when starting container-v, the folders in the home directory in my container will be empty by default. Is there any way to use the files in the host when there are files in the host directory, and to use the files in the container / home when not available? when deleting the container, make sure that the host files are still there.

Jul.28,2021

docker run-v / var/logs:/var/logs < image_name >
so that what is mounted is readable and writable on both sides.

Menu