As part of the Continuous Integration process, new builds are generated which contains certain enhancements or modification or bugfixes. For a containerized application deployment, docker images are created as part of builds which then needs to be uploaded to one of the container registries. Over the time, the registry will get filled up. Also as one use more and more space on the container registry, one needs to pay more and more.
There are no inbuilt commands or utilities provided by Docker for this. You have to write complex scripts for doing it. Fortunately, in latest round of the Azure CLI update, Microsoft has added some commands to do this. However, it can be cumbersome to select and remove docker images one at a time. Continue reading “Remove old docker images from Azure Container Registry”
In old days (not so old, albeit like a one or two year(s) ago), we used to insert a docker environment variable like IS_DOCKER_CONTAINER using dockerfile in docker images. This was used to determine if an application is running inside a docker container or not. This helped to set certain attributes of the application like logging level and methods, modify certain environmental settings etc and helped controlling behavior of the application. It can also be useful in other situations like to determine whether you want to run selenium tests or not (as selenium web drivers would not be available inside docker container) to run as part of the integration testing. Continue reading “Detecting if dotnet core app is running inside docker container”
Docker files are used to create docker images. When you are building image using Dockerfile, by default it would search for a file named Dockerfile with no file extension in the current directory context. Now normally an application have multiple environments like Dev, QA, Production etc. Few things like application settings and environmental variables will generally differ from one environment to another environment. To account for these changes and for image to work properly in these different environments, it needs to be either generic in nature (which is a very rare case and puts lots of un-necessary modification in the application code itself to account for these changes at runtime) or images needs to built for each environment separately.
Continue reading “Dockerfile Naming Convention and Organization”
Microsoft has invested billions in Azure to drive technology and also hired best of the minds on this planet. From last few months, Azure has been launching new container-focused products and services on a regular basis. One of these products is Azure Container Instances. It acts as a bridge between platform as a service and infrastructure as a service architecture. Perhaps it would be okay to call this service as “Container as a Service”. Azure Container Instances (ACI) allows to rapidly create and launch containerized applications, without any overhead and with an easily scriptable set of commands. Designed to work both on its own and with tools like Kubernetes, ACI adds container-management commands to Azure, coupling them with a billing model that’s based on per-second usage, with no need to create and deploy (and pay for) container hosts. In this blog post, we’ll create an ASP.NET Core App, containerize it and deploy it as single instance on ACI. Continue reading “Deploy ASP.NET Core App as Azure Containers Instances (ACI)”
In one of the cases with setting up builds for new source code repositories we came across this issue. One of the microservices was written in ASP.NET core using Visual Studio. It was working fine using Visual Studio or when hosted using IIS, but it fails to start with below error when using dotnet native command inside docker image. The error message was like below:
System.InvalidOperationException: A path base can only be configured using IApplicationBuilder.UsePathBase().
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Continue reading “ASP.NET Core App fails to start with error: ‘A path base can only be configured using IApplicationBuilder.UsePathBase().’”
Azure Web Apps or Azure App Service Web Apps or simply Azure Websites is a PaaS service from Microsoft Azure which can be used to host web apps or APIs build using a variety of programming languages like ASP.NET, ASP.NET Core, Java, Ruby, PHP etc. It is also optimized for hosting web applications and containers, in case the SDK version required is not already supported by Web Apps. Rather than using ACS (Azure Container Services) and AKS (Azure Kubernetes Service), Azure Web Apps are more suitable for deploying long running containers. Also they become more affordable in terms of pricing as compared to the ACS and AKS. In this post, we’ll discuss how to create a very basic ASP.NET Core App and then deploy it as a container on Azure Web App. Continue reading “Build ASP.NET Core Web App and deploy as Azure Web App on Containers”
Containerization has solved many issues related to traditional IT software. Docker and containers are almost synonymous as Docker makes it easy to wrap your applications and services in containers so you can run them anywhere. However as you work with Docker, you accumulate an excessive number of unused images, containers, and data volumes that clutter the output and consume disk space. Overtime it becomes necessary to clean up the clutter to claim disk space back and also prevent from disk getting full.
Fortunately, Docker has also certain inbuilt commands to clean up the system from the command line itself. This blog post aims to cover some of those commands that are useful for freeing disk space and keeping the system organized by removing unused Docker images, containers and volumes.
Continue reading “Remove Docker Containers, Images, Volumes and Networks”