Asp.Net 5 dev environment docker image
If you are using Linux/Mac and want to try out Asp.Net 5 (vNext), this image is for you.
It is based on Microsoft's office image: microsoft/aspnet, with an additional minimal daemon script.
How to run Asp.Net app with this image
Generate the project scaffold
I use yeoman to generate the project, search for generator
$ npm install -g yo $ yo aspnet:app
Start a docker container as development environment
Pull this image, I use boot2docker on my Mac:
$ docker pull txchen/aspnet5dev
Suppose your generated project's path is
/path/to/aspnetproject, start a new container as daemon:
$ docker run -d -p 5004:5004 --name=aspnet5dev \ -v /path/to/aspnetproject:/code \ txchen/aspnet5dev
Enter the container and launch the app
Now, let's enter the docker container, by using docker 1.3's new feature - exec:
$ docker exec -it aspnet5dev
Go to the project folder, and launch it:
$ cd /code $ kvm restore $ k kestrel
View in browser
The yeoman generated project defines the command in project.json, the port for kestrel command is 5004.
If you are using boot2docker, you need to get the boot2docker VM's IP.
If you are using docker in Linux, localhost is enough
# if using boot2docker $ boot2docker ip # Then open http://ip:5004 in browser
Woot! Asp.Net app running in kestrel/docker/linux!
To build the image
docker build --rm -t txchen/aspnet5dev .