Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image doesn't work #42

Closed
forki opened this issue Feb 20, 2017 · 17 comments
Closed

Docker image doesn't work #42

forki opened this issue Feb 20, 2017 · 17 comments
Assignees

Comments

@forki
Copy link
Member

forki commented Feb 20, 2017

We have a very simple Dockerfile that just tries to dockerize an already "published" .NETCore app:

FROM microsoft/dotnet:1.1.0-sdk-msbuild-rc4
COPY . .
ENTRYPOINT ["dotnet", "Server.dll"]

you can create the image with:

build.cmd publish

If you then run the container with:

docker run -it --rm forki/fable-suave

It fails with the error:

Error: assembly specified in the dependencies manifest was not found -- package: 'fsharp.core', version: '4.1.0', path: 'lib/netstandard1.6/FSharp.Core.dll'

This is technically correct, but I you do the following it works:

cd deploy
dotnet Server.dll

So something inside the Dockerfile is causing the runtime to look at different place.

@Petermarcu
Copy link

Are you publishing the application? Can you share your steps for building the application (server.dll)?

@forki
Copy link
Member Author

forki commented Feb 20, 2017

@Petermarcu as written above build.cmd publish

@forki
Copy link
Member Author

forki commented Feb 20, 2017

build.sh publish on Linux/MacOs

@Petermarcu
Copy link

Ok, I missed that. Looks like you are running dotnet publish as expected. You also have the PackageReference to the FSharp SDK in your Server project.

You say that it runs from the deploy. That is what I'd expect since that is where you seem to have specified to publish the application to? The contents of your deploy dir are what you should be copying into the image and executing.

@mastoj
Copy link
Contributor

mastoj commented Feb 20, 2017

Maybe this might help: https://github.com/mastoj/suavecore

A small sample app running suave on core on docker I made.

@forki
Copy link
Member Author

forki commented Feb 20, 2017

@mastoj can you see anything that I might be doing wrong?

@forki
Copy link
Member Author

forki commented Feb 20, 2017

@Petermarcu I copy the full deploy dir into the container. (first I copy the Dockerfile to /deploy and then I run docker build over there)

@forki
Copy link
Member Author

forki commented Feb 20, 2017

@Petermarcu I pushed the docker image to dockerhub at forki/fable-suave if you want to inspect the end result

@forki
Copy link
Member Author

forki commented Feb 20, 2017

Summoning @glennc (@shanselman told me you might know)

@mastoj
Copy link
Contributor

mastoj commented Feb 20, 2017

@forki, can't spot anything obvious. If it helps, here are the commands I run: https://github.com/mastoj/suavecore/blob/master/commands

you can skip the gcloud and kubectl stuff

@forki
Copy link
Member Author

forki commented Feb 21, 2017

@mastoj why do you have dotnet run before the docker build? Needed?

@forki
Copy link
Member Author

forki commented Feb 21, 2017

Also I'm using rc4 of the dotnet cli with MSBuild. So no project.json

@mastoj
Copy link
Contributor

mastoj commented Feb 21, 2017

@forki I see that the "script" might be a little bit confusing, that's because it is not a script just a file with commands that I used while playing around.

@forki
Copy link
Member Author

forki commented Feb 21, 2017 via email

@mastoj
Copy link
Contributor

mastoj commented Feb 21, 2017

That I don't know. I can't see what the problem is, mainly because I can't build the project on OSX. It shouldn't make a difference if you have project.json, at least that's what I thought.

What I needed to do, when I played with it was this (if I recall correctly):

dotnet build
dotnet publish -c Release

The I used the published bits in the container:

FROM microsoft/dotnet:core
COPY ./bin/Release/netcoreapp1.0/publish /app
WORKDIR /app
EXPOSE 8083
ENTRYPOINT ["dotnet", "suavecore.dll"]

Of course I struggled to get the correct .NET Core version, tooling etc. to get it to work, but after that it worked like a charm.

@forki
Copy link
Member Author

forki commented Feb 21, 2017

but that's exactly what we do here!?

@mastoj why is the build not working for you?

@forki
Copy link
Member Author

forki commented Feb 21, 2017

Ok thanks to @mastoj we found out that you need to put it into a subfolder inside the container. Then things work. Weird

@forki forki closed this as completed Feb 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants