Where to mount volume

Here are some examples

docker run --rm -v .:/data blabla...
docker run --rm -v .:/tmp blabla...
docker run --rm -v .:/root blabla...
docker run --rm -v .:/$HOME blabla...
docker run --rm -v .:/$PWD blabla...
docker run --rm -v .:/usr/local blabla...

What is the most correct method?
Searching on the internet it seems that everyone has their own school of thought…

1 Like

Hi

What is your question ?

The left part is your host so here the current folder.
The right part is inside the container.

This said, it’s depends on your needs.

For a custom application, I’m using /app (right part), for a website /var/www,…

But there are those who think differently

https://www.linux.org/threads/make-is-a-utility-for-end-users-or-for-programmers-developers.53813/#post-250877

Keep paths and volumes consistent and provide absolute paths:
If readme.md is in /home/me/, and you’re in ~ (/home/me/) don’t mount ./readme, rather mount /home/me/readme, use the same paths in you docker image, etc. So be consistent, be absolute, be safe.

Bonjour, merci, de rien

So once again you don’t reply to questions we’re asking to you : what is your question ? What is your need.

Read my previous answer , understand it, apply it to your own situation and if you’ve something to clarify, do it here so nice people can help you.

Au revoir, bonne soirée.

1 Like

to dockerize my app, what would be (within docker) the ideal root dir?

There is no answer, it depends on your needs. What do you want to achieve?

When you bake a bread, there is no ideal recipe, everyone prefers it a bit different.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.