dotnet docker /bin/sh: 1: [dotnet,: not found

2020-03-24 05:10发布

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"]

3条回答
趁早两清
2楼-- · 2020-03-24 05:20

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.

查看更多
萌系小妹纸
3楼-- · 2020-03-24 05:27

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"]
查看更多
太酷不给撩
4楼-- · 2020-03-24 05:28

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
查看更多
登录 后发表回答