Configure docker to start on boot on Linux

Most current Linux distributions (RHEL, CentOS, Fedora, Ubuntu 16.04 and higher) use systemd to manage which services start when the system boots. We can use below commands to configure docker to start on boot:

$ sudo systemctl enable docker

To disable this behavior, use disable instead.

$ sudo systemctl disable docker

If you are running on Ubuntu 14.04 LTS or lower, you can use upstart to help you with same:

$ echo manual | sudo tee /etc/init/docker.override

Install Docker on Ubuntu Server

As you might be already aware, Docker by Docker Inc is a widely used tool for containers. Containerization is an approach to software development in which an application and its versioned set of dependencies plus its environment configuration abstracted as deployment manifest files are packaged altogether (the container image), tested as a unit and finally deployed (the container or image instance) to the host Operating System (OS).

Containers isolate applications from each other on a shared operating system (OS). This approach standardizes application program delivery, allowing apps to run as Linux or Windows containers on top of the host OS (Linux or Windows). Because containers share the same OS kernel (Linux or Windows), they are significantly lighter than virtual machine (VM) images.

In this post, we’ll go through series of steps required to install Docker on Ubuntu Server. Continue reading “Install Docker on Ubuntu Server”

Determine .NET Framework versions installed using PowerShell

Users can install and run multiple versions of the .NET Framework on their computers. When you develop or deploy your app, you might need to know which .NET Framework versions are installed on the user’s computer. Note that the .NET Framework consists of two main components, which are versioned separately:

  1. A set of assemblies, which are collections of types and resources that provide the functionality for your apps. The .NET Framework and assemblies share the same version number.
  2. The common language runtime (CLR), which manages and executes your app’s code. The CLR is identified by its own version number (see Versions and Dependencies). Continue reading “Determine .NET Framework versions installed using PowerShell”

Ignore self-signed certificates in PowerShell

When using windows PowerShell as REST client, you may encounter certificate invalid issues for various reasons. The most likely reason should be a self-signed certificate or a invalid common name certificate or sometimes not adding SAN names in the certificates. This may cause your script to break if it relies on fetching data from remote server when communicating on HTTPS.

To avoid SSL Certificate trust issues if using HTTPS, we can use below PowerShell function to help: Continue reading “Ignore self-signed certificates in PowerShell”

Using POST method in REST API in PowerShell

In one of previous blog post, we discussed how to work with using REST APIs in PowerShell. In this blog post, we’ll discuss how to use POST method in REST API.

POST involve sending both a body and headers.

  $person = @{
   $body = (ConvertTo-Json $person)
   $hdrs = @{}
   Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType 'application/json' -Headers $hdrs

The above on several lines is easier to read than one long line: Continue reading “Using POST method in REST API in PowerShell”

Debugging PowerShell in Visual Studio Code – Part 02

In this blog post, we’ll continue from where we left earlier in the previous post on debugging PowerShell using Visual Studio code. You may be beginning to notice that the debugging features offered in Visual Studio code are far ahead in terms of usability.

Not only that, we can set line breakpoints (which can be specified by pressing F9 on code line in reference), we can also set conditional breakpoints, functional breakpoints and trace breakpoints.

A functional breakpoint can be defined as breakpoint which is invoked on calling of a particular function. You can set a function breakpoint to break into the debugger not only on a particular function invocation but also on an alias, a built-in command, or application invocation.  Continue reading “Debugging PowerShell in Visual Studio Code – Part 02”

Debugging PowerShell in Visual Studio Code – Part 01

In one of the previous post, we discussed how to use visual studio code for PowerShell development. Writing scripts in Visual Studio code is now more or less at par with ISE (Integrated scripting environment) and in a few cases, is more useful. However, you do need to be able to make sure that whatever code you have written in PowerShell, should be able to run as intended. Also, if its not working as intended, you should be able to debug and see where you went wrong. In this blog post, we’ll discuss how to use Visual Studio code for debugging. These features are provided by the PowerShell extension, or, more accurately, by the PowerShell Editor Services module which comes with the PowerShell extension. PowerShell Editor services not only provides language services to the Extension (which in turns provide services to Visual Studio code) but also provides useful debugging features. Continue reading “Debugging PowerShell in Visual Studio Code – Part 01”