0

Here is my project file.

❯ ls                                                                                     ─╯
BosApp     BosApp.sln Dockerfile README.md

Inside the BosApp we have

ApiException.cs                               ShareModel.cs
BosApp.csproj                                 Startup.cs
Controllers                                   UserNotAuthorizedException.cs
Data                                          Views
Dockerfile                                    appsettings.Development.json
ExceptionMiddlewareExtensions.cs              appsettings.json
Migrations                                    bin
Models                                        libwkhtmltox.dll
Program.cs                                    libwkhtmltox.dylib
Properties                                    obj
RequestResponseLoggingMiddleware.cs           robots.json
RequestResponseLoggingMiddlewareExtensions.cs web.config
Services                                      wwwroot

My docker file

FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /APP

RUN dotnet restore
RUN dotnet build

EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
ENV ASPNETCORE_ENVIRONMENT docker

ENTRYPOINT dotnet run

In the terminal, inside the project structure where I have DockerFile, I am writing :

docker build -t bosapp-demo .

Output is this :

❯ docker build -t bosapp-demo .                                                          ─╯
Sending build context to Docker daemon  214.8MB
Step 1/9 : FROM microsoft/dotnet:latest
 ---> 56a634b88a04
Step 2/9 : COPY . /app
 ---> dec32085afa9
Step 3/9 : WORKDIR /APP
 ---> Running in 5575edfaab03
Removing intermediate container 5575edfaab03
 ---> 1bc0fb3179c0
Step 4/9 : RUN dotnet restore
 ---> Running in 1138521bd5e0
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
The command '/bin/sh -c dotnet restore' returned a non-zero code: 1

I am trying to create docker image first time and have that type of problem.

Any help and advice will be worth for me.

4
  • You are missing the .dll file. See docs.docker.com/engine/examples/dotnetcore Commented Mar 6, 2020 at 17:20
  • 1
    @RicardoPeres AFAIK, the question-asker's intent is to do the build inside the container. There wouldn't be a existing .dll file in this case to copy. Commented Mar 7, 2020 at 0:24
  • You’re right, sorry! Commented Mar 7, 2020 at 5:41
  • Why don't you use VS docker file creator? right click on your project then add Docker Support ... Commented Mar 8, 2020 at 2:24

1 Answer 1

2

It looks like you're specifying different directories:

COPY . /app
WORKDIR /APP

Try changing to:

COPY . /app
WORKDIR /app
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.