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

Viewed 11285

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

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

Above answers are quite clear, but I followed above and changed my CMD [ 'node', 'app.mjs' ] to CMD [ "node", "app.mjs" ], made sure I added a comma, same thing still happened.

After I mess around for a little while, I started to think, maybe I need to rebuild the docker file again, so I did docker build . again. Boom, it works this time!

Such a rookie's mistake! just like when I made changes to Java repo but I don't rebuild the java repo so error still happens.

Related