Open In App

Microsoft Azure – Running an App inside a Docker Container Image

Last Updated : 31 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we’ll learn how to run an app inside of a container with Docker. For this, you need to set up Docker on your local Dev machine, by going to docker.com, and installing the Docker desktop application for your specific operating system. We can use the Docker Pokemon to pull an image from the Docker Hub onto your local machine. 

Here, we’re going to use that same image to create a running container. We will open up our command line terminal and start by typing in the Docker images command. 

docker images

This should list all of the available images that are on our machine, and this should include that microsoft/asp.netcore-build image

Now we are going to execute another Docker command to run that image:

docker run -it --name myapp microsoft/aspnetcore-build

And this is going to signal to the Docker client that we actually want to run this image in a container. The  -it is used to specify that we want to engage with the container using an interactive terminal. Then we have given our image a name. We’re going to call this “Myapp”. The last thing we need to do is specify the name of the image we want to use to create this container.

 In no time at all, our container has been started, and we’re now connected to it by an interactive terminal. 

So, since this is a.NET container, we should be able to use the below command:

 dotnet --info

It gets some info about the.NET command-line tools, that SDKs that are available.

We can also type in uname -r, and this should give us some information about the operating system and Kernel. Since we are running on a Linux container. 

Next, let’s actually create a.NET application. So, first thing we’ll do is we’ll create a folder. We’ll call this “Myapp”. 

Next, we’ll type in dotnet new and the type of application we want to create. So, in this case, we want to create a new console application. 

Now, all we need to do is type dotnet run, and as expected it prints out “Hello world!” from the script because that’s really all our simple console application is doing. 

So, you’ve just seen how easily we could create a container based on an image that we have on our local Dev machine, and create a running application inside of it.


Previous Article
Next Article

Similar Reads

Microsoft Azure - Mount Azure Storage in Container App In App Service
In this article, we are going to learn how to mount Azure Storage as a local share for App Services Linux web apps. Implementation: So to start the process of connecting to Azure Storage mount, you should click on configuration. Once you are inside the configuration blade, click on path mappings. Start by giving it a name. For eg name it s1share. A
3 min read
Microsoft Azure - Mounting Azure Storage in a Container App
In this article we will learn how to mount Azure Storage as a local share for App Services Linux web apps. In the given article we are going to demonstrate how to mount Azure Storage as a local share for a container app deployed on Azure App Services for Linux. So to start the process of connecting to Azure Storage mount, you click on configuration
3 min read
Microsoft Azure- Building and running a MEAN-based application in Azure
MEAN stack refers to the technology stack that is often used together to build web applications, and is an abbreviation that stands for: M: MongoDB - A NoSQL Database.E: ExpressJS - A web server framework for Node.js, based on JavaScript.A: Angular - A frontend framework, based on JavaScript.N: NodeJS - A server side runtime environment based on Ja
9 min read
Microsoft Azure - App Settings in Azure App Services
In this article, you will learn how to work with App Settings in Azure App Service. In Azure Application Services, you can use App Settings to store and change configuration information without having to change any of your application code. Implementation: Follow the below steps to work with App settings in the Azure App service: Step 1: If you go
2 min read
Microsoft Azure- Backing Up, Restoring, and Cloning Microsoft Azure App Services
Microsoft is well known for developing relevant software which are using in today's time of technology to conquer the demand of users and developers to build up applications. In sequence of it Microsoft introduces Azure well known as Microsoft Azure to make quality applications. In this article, we will discuss Backing up, restoring and cloning Mic
8 min read
Microsoft Azure - Adding Data to Azure Container
Pre-requisite: Azure Blob Versioning A text and binary data object store with huge scalability. support for big data analytics and the addition of media, such as photographs and videos. An object storage option for the cloud is Azure Blob Storage. It can hold enormous volumes of textual or binary data because Azure Blob Storage is unstructured, the
3 min read
Microsoft Azure - Container Registration for App Deployment
In this article, we will learn how to use Azure Container Registry to run a .NET Core App. Azure Container Registry is a place where you can store your container images securely. Let's deploy a container image to it and see how we can use it. To follow along, you'll need the following: Visual StudioDocker Desktop. Here in Visual Studio, we've creat
2 min read
How To Deploy A Container To Azure Container Instances ?
In layman's terms, how will it feel when a developer develops an app and a member of the testing team tries to test the application on his/her OS? They will have to install the packages, and libraries required to run the app. Well, in this case, the container makes it easy and faster to rapidly deploy and scale applications. The container provides
8 min read
Docker - Docker Container for Node.js
Node.js is an open-source, asynchronous event-driven javascript runtime that is used to run javascript applications. It is widely used for traditional websites and as API servers. At the same time, a docker container is an isolated, deployable unit that packages an application along with its dependencies, making it highly scalable and maintainable.
7 min read
How to Use Docker Content Trust to Verify Docker Container Images
The world of containerized applications is based on trust. You rely on Docker images to be exactly what they say they are: secure, reliable, robust, and built with the right elements. But just like you can not just blindly trust any random ingredient in your kitchen, similarly the Docker image needs a kind of verification so we don't need to be con
12 min read