Docker - Copy file to a location during docker run

enthuguy
enthuguy used Ask the Experts™
on
Hi Docker experts,

as part of docker run, i mount a NFS volume to the container,

but inside the container, would like to copy a file from the mounted volume and copy to a different location inside the container during docker run

since files in this volume will be more dynamic. I can only copy file after mounting

please suggest/advice
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Keep in mind Docker has no concept of persistent data, so you'll do this by allocating some directory (called a Docker volume) which will only be used by your Docker instance + no other code.

Then as container starts, copy the NFS file to the local Docker volume.
nociSoftware Engineer
Distinguished Expert 2018

Commented:
Why not have the NFS volume mounted on  a -v exported directory.
And use the NFS  volume. to manipulate all data.
DevOps Engineer
Distinguished Expert 2018
Commented:
Mount the NFS volume to docker hosted node . once this is done mount the same volume to docker container.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial