I build successfully with dockerfile, but when I try to run a new container from the build image, I get the following error:
What do i have to do for the solution?
Error : /bin/sh: 1: [dotnet,: not found
docker run command:
docker run --rm -it -p 8080:80 furkaandogan/myapp:0.1
Dockerfile:
FROM microsoft/aspnetcore:1.1
ARG source
WORKDIR /app
ENV ASPNETCORE_URLS http://*:80
EXPOSE 80
COPY ./publish/myapp .
ENTRYPOINT ["dotnet", "myapp.dll"]
I faced similar issue. In my case the problem was in the entry point statement in Dockerfile. I was missing a comma between two parameters "dotnet" and "url for dll".
Before:
CMD ["dotnet" "url to dll"]
After fix applied:
CMD ["dotnet", "url for dll"]
There is something on your entrypoint line of the Dockerfile to trigger docker into seeing it as invalid json and it's falling back to shell execution of the string instead. It looks correct in what you pasted, so I'd check for characters like smart quotes or perhaps a Windows newline at the end of the string.
The problem is that the docker ignore file does not allow the copy address
I solved the problem by adding the address to the docker ignore file or using the allowed file address
Old dockerignore config
*
!obj/Docker/publish/*
!obj/Docker/empty/
new dockerignore config
*
!obj/Docker/publish/*
!obj/Docker/empty/
!publish/myapp