1

I can succesully install and run an ASP.Net MVC application https://github.com/aspnet/Home/tree/dev/samples/1.0.0-beta4/HelloMvc on docker using:

Dockerfile

FROM microsoft/aspnet

COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]

EXPOSE 5004
ENTRYPOINT ["dnx", "." "kestrel"]

Build

docker build -t myapp .

Run

docker run -t -d -p 80:5004 myapp

The Buildstep takes 2minutes, thats why I don't want to to run all the steps when I changed some files during development. What workflow would I use when developing for a runtime that is hosted in docker? Or is docker not the right environment for development?

EDIT I copied all files of the application including the dockerfile to "/dev_app" changed to that directory and run

  $ docker run -v /dev_app:/app -d -p 80:5004 myapp

The output is the id of the container

docker ps

Does not show any entries. Is there still something missing?

EDIT 2

executing

docker log [myid]

returns

    System.InvalidOperationException: Unable to resolve project 'app' from /app
  at Microsoft.Framework.Runtime.ApplicationHostContext..ctor (IServiceProvider serviceProvider, System.String projectDirectory, System.String packagesDirectory, System.String configuration, System.Runtime.Versioning.FrameworkName targetFramework, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheDependencyProvider, IAssemblyLoadContextFactory loadContextFactory, Boolean skipLockFileValidation) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.Runtime.DefaultHost.Initialize (Microsoft.Framework.Runtime.DefaultHostOptions options, IServiceProvider hostServices) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.Runtime.DefaultHost..ctor (Microsoft.Framework.Runtime.DefaultHostOptions options, IServiceProvider hostServices) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

1 Answer 1

1

During development, put the code in a directory on host and mount that into the container, over the top of the existing code. For example, if you put a copy of the code in dev_app in your current directory:

$ docker run -v $(pwd)/dev_app:/app -d -p 80:5004 myapp

Any changes to the code in the dev_app directory will be reflected immediately in the container. When you've finished making changes, you can rebuild the container with the new version of the code for distribution.

Sign up to request clarification or add additional context in comments.

2 Comments

That sounds good.But I was still not sucesfull. Please check the edited question.
@MalcolmFrexner. That's a completely different question now. The number is the ID of the container. If you run docker logs ID it should tell you what happened. If you still have problems, open a new question.

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.