Docker Community Forums

Share and learn in the Docker community.

FileNotFoundException when accessing file using absolute path


(Atrz) #1

Hi all,

I have an app which I am trying to run via Docker. My app accesses file using the absolute path but I get
"FileNotFoundException: /tmp/myDir/myFile.txt (No such file or directory)" even though file exists on the system.

I found out there are Volumes in Docker so I tried to set my path as a volume by using flag “-v /tmp/myDir:/tmp/myDir” but still get same Exception. (I tried some variations of this flag). (I am new to Docker)

I am running app via VirtualBox MINGW (I have installed Docker Toolbox on my Windows 10, which created MINGW via VirtualBox from where I run Docker).

I have also pushed app and tried to run on the “clear CentOS on VirtualBox” but error is same.

What I am missing?

BR,
atrz


(Atrz) #2

To reply to myself if someone stumbles upon this.

Volume needs to be used, but I have used it incorrectly.

With mount command we get how disk is mounted:

mount
C:/Users/username/AppData/Local/Temp on /tmp type ntfs (binary,noacl,posix=0,usertemp)

so when running app, -v flag should be configured in this way:

docker run -v /c/Users/username/AppData/Local/Temp:/tmp ...

After configuring correctly, it works - file can be accessed.