If i want my docker image to directly take data from a folder which is present in my system, is that possible.
If yes then how can I do it.
Thanks.
If i want my docker image to directly take data from a folder which is present in my system, is that possible.
If yes then how can I do it.
Thanks.
The usual practice is to use docker volume (bind mount) at runtime.
That way, your container, inside
/app
, has access to your host path (here$pwd/target
)In a docker-compose file, see docker compose volume syntax:
In your case, use:
If you use docker-compose you can define
volumes
to share folders from your system. In example bellow the mysql will use./data/db/mysql
folder to store/read data (because as default it uses/var/lib/mysql
in linux).Also you must to be sure that provided volume has correct permissions and docker have read/write access to it.