0

I am currently running a docker container with a specific folder shared to it. However, I need to access other folders which are not in the shared folder.

Does docker mount or docker volume help in any way to mount a file into a running docker container?

Bharath kumar k
  • 119
  • 2
  • 5
  • 13

2 Answers2

0

You can do this in two ways.

  • just copy the file and paste it the shared location, it will be available for use in docker mount location.
  • copy the host file to the container where you want, using
docker cp your_local_file containerid:/path/to/container

There are other ways around but that will not be that easy as these two approaches.

You can check this details article but I think it will take your handsome time to that each and every time.

mount-volumes-into-a-running-container

You can also check

docker-mount-dynamic-volumes/

Adiii
  • 54,482
  • 7
  • 145
  • 148
0

I was thinking one alternative could be to use soft links by placing them inside your mounted volume but it won't work as documented in this post. A suggested alternative is to mount your folders as different volumes:

-v /home/test/:/home/test -v /mnt/mountedfile:/mnt/mountedfile

K F
  • 1,368
  • 13
  • 20