UPDATE (2016-OCT-10): Everything has changed, for the better. This process is much easier now. I will follow-up soon with a new guide.
For my tests, I sparked up an Ubuntu 14.04 64-bit image in Parallels.
Following the instructions on the Asp.Net site, I was able to get Asp.Net 5 installed on my image.
Here are the steps broken down:
Install the .NET Version Manager (DNVM)
Use the .NET Version Manager (DNVM) to install different versions of the .NET Execution Environment (DNX) on Linux.
Install unzip and curl if you don’t already have them:
Download and install DNVM:
Once this step is complete you should be able to run dnvm
and see some help text.
dnvm
will output:
___ _ ___ ____ ___ / _ \/ |/ / | / / |/ / / // / /| |/ / /|_/ / /____/_/|_/ |___/_/ /_/ .NET Version Manager - Version 1.0.0-rc2-15545 By Microsoft Open Technologies, Inc. DNVM can be used to download versions of the .NET Execution Environment and manage which version you are using. You can control the URL of the stable and unstable channel by setting the DNX_FEED and DNX_UNSTABLE_FEED variables. Current feed settings: Default Stable: https://www.nuget.org/api/v2 Default Unstable: https://www.myget.org/F/aspnetvnext/api/v2 Current Stable Override: <none> Current Unstable Override: <none> Use dnvm [help|-h|-help|--help] to display help text.
Install the .NET Execution Environment (DNX)
The .NET Execution Environment (DNX) is used to build and run .NET projects. Use DNVM to install DNX for Mono or .NET Core.
To install DNX for .NET Core:
- Install the DNX prerequisites:
- Use DNVM to install DNX for .NET Core:
To install DNX for .NET Core:
- Install Mono
Breaking down the instructions at http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives:
- Use DNVM to install DNX for Mono:
Install libuv
Libuv is a an IO library that is used by Kestrel.
To build libuv, run each of the following steps:
Install Node.js and npm
Install yeoman and the Asp.Net 5 generator
Install Docker
My suggestion would be to use the official instructions at http://docs.docker.com/engine/installation/ubuntulinux/, however, I followed the posting at https://blog.markrendle.net/fun-with-asp-net-5-linux-docker-part-3/.
To verify that it is installed:
It should return something like this:
Docker version 1.9.1, build a34a1d5
To get around having to use sudo
on every Docker command, run the following four commands, replacing ${USER} with your own username:
###Create a new Asp.Net web application
Follow the instructions to create a basic web application.
Open a web browser and point it at http://localhost:5000 and you should see a standard template site.
###Deploy a Docker container
Create a Docker container
Inside of the folder that houses your web application’s source code, you will find a Dockerfile
file. The generator that I was using, created:
Run the Docker container
Swap out {yourapplication} for the actual name of your application
Now if you open your web browser and point it to http://localhost:5000 and you should see the same template site that you saw earlier.
EXCEPT THAT I DIDN’T!
Turns out that Docker forwards requests on 0.0.0.0
, but Kestrel (the web server) listens on localhost
. I got this information from http://stackoverflow.com/questions/33977474/cannot-run-asp-net-5-from-docker via answers by users @trm5073 and @armen.shimoon.
Find the container’s id:
The response will look something like this:
Use the Container ID to stop the container:
Open the Dockerfile
and change it to:
Now run the container again:
Point your browser to http://localhost:8080 and tears of disbelief…