Docker Community Forums

Share and learn in the Docker community.

Copy command do not copy files

Hello to you all.

My colleague and I are currently using a docker file to build our project and we are using the “COPY” command to copy “.so” file into container folder. Docker file is below. But it do not for at all. File is not in the folder /app/bin/Debug/netcoreapp3.1/. No errors are displayed.

We are using docker desktop version (46911), WIN10, Visual Studio Enterprise 2019 (16.6.5).

FROM AS base
RUN apt-get update -y
RUN apt-get install sudo -y
RUN apt-get install cmake -y
RUN apt-get install git -y

RUN apt-get install -y build-essential libtiff5-dev libgeotiff-dev libgtk-3-dev libgstreamer1.0-dev libavcodec-dev libswscale-dev libavformat-dev libopenexr-dev libdc1394-22-dev libv4l-dev libeigen3-dev libtbb-dev cmake-curses-gui ocl-icd-dev freeglut3-dev


FROM AS build
COPY ["ColorDetector/ColorDetector.csproj", "ColorDetector/"]
RUN dotnet restore "ColorDetector/ColorDetector.csproj"
COPY . .
WORKDIR "/src/ColorDetector"
RUN dotnet build "ColorDetector.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ColorDetector.csproj" -c Release -o /app/publish

FROM base AS final
COPY --from=publish /app/publish .
COPY ["ColorDetector/openCvLibs/ubuntu/20.04/", "/app/bin/Debug/netcoreapp3.1/"] //THIS COPY DO NOT copy FILE...
ENTRYPOINT ["dotnet", "ColorDetector.dll"]

We already tried different variations like:

COPY ColorDetector/openCvLibs/ubuntu/20.04/ /app/bin/Debug/netcoreapp3.1/
COPY ColorDetector/openCvLibs/ubuntu/20.04/ bin/Debug/netcoreapp3.1/
COPY ["ColorDetector/openCvLibs/ubuntu/20.04/", "/app/bin/Debug/netcoreapp3.1/"]

Or copy simple txt file like:

COPY ColorDetector/openCvLibs/test.txt bin/Debug/netcoreapp3.1/
COPY ColorDetector/openCvLibs/test.txt /app/bin/Debug/netcoreapp3.1/
COPY ColorDetector/openCvLibs/test.txt /app/bin/Debug/netcoreapp3.1/test.txt

The file was never in the desired folder.

Can somebody help us with it? Has a similar issue happened to anyone?

Have you checked if your installation is able to mount the local filesystem into a container? There have been some users who have reported that they are not able to mount files and folders with Docker Desktop and WSL2 (example).

Project is copied but another files not. That’s not that case. I am still running on old windows 10 version and WSL2 is available on Windows 10(Version 2004).