Docker .NET Core and PowerShell Core

Asked by At

Been trying for hours to install PowerShell Core onto a base image

FROM microsoft/dotnet:2.2-runtime AS base

Tried this

RUN  apt-get update \
  && apt-get install -y wget \
  && apt-get -y install apt-transport-https curl \ 
  && apt-get install software-properties-common \
  && rm -rf /var/lib/apt/lists/*



  # Download the Microsoft repository GPG keys
RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

# Register the Microsoft repository GPG keys
RUN dpkg -i packages-microsoft-prod.deb

# Update the list of products
RUN  apt-get update
RUN add-apt-repository universe \ 
    RUN apt-get install -y powershell

No Luck..

tried this Also

RUN apt-get update     && apt-get install -y --no-install-recommends         apt-utils         ca-certificates         curl         apt-transport-https         locales    && rm -rf /var/lib/apt/lists/*
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/microsoft.list
RUN apt-get update     && apt-get install -y --no-install-recommends     powershell

Then I thought about trying the reverse, using this base image

FROM microsoft/powershell AS base

And Installing .Net Core SDK

RUN apt-get update     && apt-get install -y --no-install-recommends         apt-utils         ca-certificates         curl         apt-transport-https         locales    && rm -rf /var/lib/apt/lists/*

RUN apt-get update     && apt-get install  dotnet-sdk-2.2

Of course.. No luck..

I have a .NET core application that needs to make a call to PowerShell core. Are there any containers/images that have this already? Am I missing something here?

0 Answers