#Visual Studio 2015 Docker extension
If you have Visual Studio 2015 installed you can utilize the new Docker extension, which is available in the Visual Studio Gallery
From the Visual Studio Gallery the extension is described as follows:
The Visual Studio 2015 Tools for Docker Preview enables developers to build and publish an ASP.NET 5 Web or console application to a Docker container running on a Linux virtual machine.
The Visual Studio 2015 Docker extension requires the Microsoft ASP.NET and Web Tools 2015 to be installed.
##Docker daemon
To be able to remote-control you Docker host you must start the Docker daemon. The Docker daemon allow you to use the Docker CLI tools from another machine.
By default, the docker daemon will use the unix socket unix:///var/run/docker.sock
(you can check this is the case for you by doing a sudo netstat -tunlp
and note that there is no docker daemon process listening on any ports).
To start the docker daemon with a TCP socket that anybody can connect to, use the -H option
sudo docker -H tcp://0.0.0.0:2376 -d &
This is not the recommended approach as anybody can connect to your Docker daemon and manage your containers. See the protect the Docker daemon socket.
The Docker host is behind a firewall, therefor you need to enable port-forwarding for port 2376 in this case. See the open Azure endpoint guide.
-
Create a new ASP.NET web application project. On the main menu, choose File, New Project. Under C#, Web, choose ASP.NET Web Application.
-
In the list of ASP.NET 5 Preview Templates, choose Web Site.
-
Since the web app will be hosted/run in Docker, clear the Host in the cloud checkbox if it's selected and then choose the OK button.
This is the point where you'd typically add code to the web app to make it do something useful, but for this example, let's just leave it at its default settings. (Note that you can also choose to use existing ASP.NET 5 web apps.)
##Deploy ASP.NET 5 website to a Docker container
-
On the ASP.NET project's context menu, choose Publish.
-
In the Select a publish target section of the Publish Web dialog box, choose the Docker Containers button.
-
If you're already logged into an Azure account, skip to step 5. If you're not logged into an account, choose the Add an account button.
-
In the Sign in to Visual Studio dialog box, enter the email account for your Azure subscription and then choose the Continue button.
-
Choose existing Docker host.
-
If your Docker daemon is not secure, then remove the
--tlsverify
-
Test the connection to the Docker daemon by pressing Validate connection.
-
Press Publish, and follow along in the build output.
-
The website will available on port 80 (default), so you need to add port-forwarding. See the open Azure endpoint guide.
Remember to start your ASP.NET 5 Docker container!
Then you will be able to navigate to the site in your browser.