Score:0

docker, mount container folder to host

us flag

I need mount container's folder to host with all content from container.

In the container, there is this folder and there are a lot of files.

/u01/app/oracle/product/19.3.0/dbhome_1

On my host, I have this empty folder.

/opt/oracle/ohome

I need mount folder /u01/app/oracle/product/19.3.0/dbhome_1 from container to host folder /opt/oracle/ohome, with all his content.

I need use files from container on host.

I tried this (and with source/target path changing too).

docker run -d -p 1521:1521 --shm-size=3g --name oracle -v /opt/oracle/ohome:/u01/app/oracle/product/19.3.0/dbhome_1 IMAGE

I tried with bind too, but no success, folder is empty in every case.

How can I do that?

Thanks.

in flag
I have generally found it easier to go the other way around: share a directory on the host with the Docker container. This allows for multiple containers to use the same source directory (if that's something you need in the future)
EODCraft Staff avatar
cn flag
Does Docker have Permission to write to /opt/ ?
Stanislav Hosek avatar
us flag
@EODCraftStaff Yes, all permissions are allowed. About mount from host to container, I know about it, but it is not good way for this case, but thanks matigo.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.