I'm new to docker, sorry if my question is too basic, below is my dockerfile:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
COPY dist /app
WORKDIR /app
EXPOSE 80/tcp
ENTRYPOINT ["dotnet", "ExampleApp.dll"]
I got an error:
"exampleApp encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified."
So I created an image and start an instance, it was running OK.
But when I try to copy a file to the container:
docker cp ./Views/Home/Index.cshtml exampleApp:/app/Views/Home/
there is a "no such directory" error in powershell, then I ran docker diff exampleApp to see the file system, I couldn't find the app directory in the container:
bur I did specify app as working directory inside the container, so why this folder is not appearing in the container?
For a Docker images for ASP.NET Core, I would add to your Dockerfile right after the COPY line:
RUN dir . /s /b sortorder:N
Just to make sure what has been copied, and if the /app/Views/Home/ does indeed exist.
Related
My Docker File -
FROM mcr.microsoft.com/dotnet/aspnet:3.1
ENV ASPNETCORE_URLS=http://*:5000
ENV ASPNETCORE_ENVIRONMENT="production"
EXPOSE 5000
WORKDIR /app
COPY ./dist .
ENTRYPOINT ["dotnet", "JustLogin.API.dll"]
The Image builds successfully via command prompt but when trying to run in it via visual studio it throws error and by docker desktop it doesn't shows any error but site still doesn't run
the dist folder location was inside child folder.But project was building by default for root path
I have an application I'm creating a docker image for, the image is created but when I run it the container errors saying it cannot find the executable file.
Here is my docker file:
FROM alpine:3.14
WORKDIR /
EXPOSE 3000
COPY ./weather-api /weather-api
CMD ["/weather-api"]
I've included a RUN ls -la immediately above the CMD which shows the file is there whilst building the image is being built, and I've included a shell script with la -la as the CMD which has shows that the files is there when the image is being ran.
This is the error I'm getting:
standard_init_linux.go:228: exec user process caused: no such file or directory
When I try to call the weather-api from a shell script I get the standard file not found error.
I've tried using an absolute and relative path for the command, copying the file to /usr/local/bin which I think should put it on the PATH so it would be callable from anywhere, changing COPY to ADD.
I'm still new to docker so any help would be greatly appreciated.
I'm trying to build an image of a .netcore v2.2 WebAPI app from docker file. But I'm getting a "no such file or directory" error while I try to build the image using following command:
docker build -t helloworld .
I have both microsoft/dotnet "latest" and "2.2-aspnetcore-runtime" base images installed in my machine.
Here's my docker file
FROM microsoft/dotnet
RUN mkdir /app
COPY ./bin/Release/netcoreapp2.2 /app
WORKDIR /app
ENTRYPOINT ["dotnet", "/app/HelloWorld.dll"]
# ASP.NET Core: Kestrel should listen on all IPs
ENV ASPNETCORE_URLS="http://0.0.0.0:5000"
Here's the folder structure of my solution (I tried the command inside the src):
Here's the output directory
Here's the full error details from the docker:
COPY failed: stat /var/lib/docker/tmp/docker-builder896068669/bin/Release/netcoreapp2.2: no such file or directory
you may change ./bin/Release/netcoreapp2.2 to ./bin/release/netcoreapp2.2
folder names are case sensitive
It seems the file ./bin/Release/netcoreapp2.2/publish does not exists on the machine on which you are running docker build
When you run docker build -t helloworld . it will copy all the file in . (i.e. the current directory from which you run the command) to the build context which will then be used when running COPY instructions, so you need to make sure you are running your command from the proper directory where files will be available to COPY
You can also run the same command from another directory by specifying the path to be used as build context such as docker build -t helloworld /path/to/my/dir
So, I am new to Docker but after trying a couple of times I can't get this to work.
Basically I have a simple script like this:
Dockerfile
from centos:7
.....
COPY /C:/Users/Kalin/Drive/web/sites/foo.com/ /var/www
EXPOSE 80
Whenever I run docker build everything works as planned except at the COPY part I get this error:
Step 10/11 : COPY /C:/Users/Kalin/Drive/web/sites/foo.com/ /var/www
COPY failed: stat /var/lib/docker/tmp/docker-builder646917435/C:/Users/Kalin/Drive/web/Kalin/foo.com: no such file or directory
I get the error is about not finding a directory, but instead of looking for it starting from C:/.. foldedr it is looking from /var/...
I don't know what mistake I am doing
I would strongly suggest to make relative path in COPY command so if you have your docker file in /C:/Users/Kalin and you are running docker build from that folder, just place Drive/web/sites/foo.com/ in COPY command
I have a project which is Maven based multi module project
It has various modules with in, like common-utils, web, theme, etc, etc
And also in the root location it has the Dockerfile which is not default one but I have named it Dockerfile.cli due to some requirements
Dockerfile.cli contents here:-
FROM tomcat
ENV NEUW_LOG_HOME /neuw/web/logs
RUN echo "running the image, making it a container :-)"
RUN mkdir -p "/neuw/web/theme-v4"
COPY web/target/web.war /usr/local/tomcat/webapps/ROOT.war
COPY theme-v4 /neuw/web/theme-v4
CMD ["catalina.sh", "jpda", "run"]
Now why I am here -> am getting the below error while building the image:-
COPY failed: stat /var/lib/docker/tmp/docker-builder838877607/web/target/web.war: no such file or directory
The command I use to run the image build is like below and running it on the root of the project which contains both theme and web folder:-
docker build -f Dockerfile.cli -t neuw/web:snapshot-30 .
Any hints and help for the issue?
Which directory are you in when you run this command? Could you do ls /web/target/ from that directory? I ask because I think your Dockerfile is expecting to find a web.war in ./web/target relative to the directory you are running in.
Edit (to save anyone digging through the comments on this): The target directory did contain the file but it was invisible to docker due to a .dockerignore file with **/target.