How to install Perl from Command Line for Automation on Windows and Dockerfile

March 03, 2021


Often in automation, we need to install stuff from command line, not from the UI. We will install Perl from command line, and with Dockerfile.

How to Install Perl from Command line

As we have seen in previous post on How to install packages from command line This post is motivated from that only.

Install Chocolatey first

Open powershell

RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \
 [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'; \
 iex ((New-Object System.Net.WebClient).DownloadString(""));

Install Perl

Once chocolatey is installed, you need to fire just one command to install strawberry perl or activeperl.

choco install strawberryperl -y;

Via Dockerfile

FROM microsoft/windowsservercore:ltsc2016

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; `
 [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'; `
 iex ((New-Object System.Net.WebClient).DownloadString("$env:CHOCO_URL"));
RUN choco install strawberryperl -y;

Similar Posts

Latest Posts