Docker - 'Directory not found' error

Hello Everyone
Can any one help me on this error

In my code base I’m using Network Path (\abc\files) of Hosted System

But when I’m running the image on docker I’m getting error as Directory not found where the /app/ is coming at the start of directory (/app/\abc\files)

where /app is coming from
WORKDIR /app
of DockerFile

Is this a linux or windows container?

Assuming this is windows host, linux container, may be trying to mount a UNC path. It seems like docker doesnt support UNC paths out of the box, but there’s an article which might help (windows build 1709+): https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/persistent-storage#smb-mounts (SMB Global Mapping)

More likely it’s trying to use a relative path when you mean to use an absolute

Which is often a sign of trying to use Windows-isms in a Linux environment :slight_smile:

Hi
I had tried to mount my drive in container
docker run -p 81:81 -e ASPNETCORE_ENVIRONMENT="QA" --name project1 --mount type=bind,source=\\MyServer\MyShare\path\to\file,target=/app project1 :latest
but getting the error

EXTRA string=\\MyServer\MyShare\path\to\file is not a valid Windows path

Docker File

RUN apk add icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
WORKDIR /app
RUN apk add --no-cache tzdata
EXPOSE 80

FROM [mcr.microsoft.com/dotnet/sdk:5.0-alpine](http://mcr.microsoft.com/dotnet/sdk:5.0-alpine) AS build
WORKDIR /src
COPY ["Project/Project.csproj", "Project/"]
RUN dotnet restore "Project/Project.csproj" --source [https://api.nuget.org/v3/index.json](https://api.nuget.org/v3/index.json)
COPY . .
WORKDIR "/src/Project"
RUN dotnet build "Project.csproj" -c Development -o /app/build

FROM build AS publish
RUN dotnet publish "Project.csproj" -c Development -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Project.dll"]```
For image
```docker build -t Project1 -f Project\Dockerfile .```
For Container
```docker run -p 81:81 -e ASPNETCORE_ENVIRONMENT="QA" --name Project1 Project1 :latest```
C# Codebase
```DirectoryInfo watchDirInfo = new DirectoryInfo("\\abc\file$\doc\test");

FileInfo[] fileInfos = watchDirInfo.GetFiles(_filePattern, SearchOption.TopDirectoryOnly);```
Error
``` Could not find a part of the path '/app/\\abc\file$\doc\test'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)```
where *(\\abc\file$\doc\test)* is a network drive path

So I see Alpine in the base container name, this is a Linux container as I said

That means that even though you think you’re on a Windows machine, Docker is actually running in a Linux VM

So it doesn’t understand Windows-isms

(at least not all of them)

So what should i do to mount my network path on the docker container

i had used
docker run -p 81:81 -e ASPNETCORE_ENVIRONMENT="QA" --name project1 --mount type=bind,source=\\MyServer\MyShare\path\to\file,target=/app project1 :latest
but it is not recognizing \\MyServer\MyShare\path\to\file as a correct path and giving the error
EXTRA string=\\MyServer\MyShare\path\to\file is not a valid Windows path

Check their docs? For all I know you literally can’t

You could mount the UNC path as a drive

We will mount path on drive on local but how will that happen on production

I know nothing of your production servers so I can’t comment

In general this is not a thing you would do anyway

docker run is not how you run things in production in anything but the most basic of systems

For Kubernetes you would use something like https://github.com/kubernetes-csi/csi-driver-smb

Can i replicate these steps on my local somehow to see how the things work in production with kubernatives