Search This Blog

Tuesday, March 9, 2021

Missing WSMan client and missing liblibpsrpclient in establishing remote sessions using powershell from a docker container

https://github.com/PowerShell/PowerShell/issues/8548#issuecomment-793595858 


FROM mcr.microsoft.com/dotnet/sdk:3.1-buster


RUN apt-get update \

    && apt-get install --no-install-recommends -y \

    # less is required for help in powershell

        less \

    # requied to setup the locale

        locales \

    # required for SSL

        ca-certificates \

        gss-ntlmssp \

        libicu63 \

        libssl1.1 \

        libc6 \

        libgcc1 \

        libgssapi-krb5-2 \

        liblttng-ust0 \

        libstdc++6 \

        zlib1g \

    # PowerShell remoting over SSH dependencies

        openssh-client \

    && apt-get dist-upgrade -y \

    && apt-get clean \

    && rm -rf /var/lib/apt/lists/* \

    # enable en_US.UTF-8 locale

    && sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \

    # generate locale

    && locale-gen && update-locale

                                               

# https://github.com/PowerShell/PowerShell/issues/8548

RUN apt-get -y install wget

RUN wget "http://http.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb"

RUN dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb

RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb"

RUN dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb     

#install powershell WSMan.Management module (https://www.bloggingforlogging.com/2020/08/21/wacky-wsman-on-linux/)

RUN pwsh -Command "Install-Module -Name PSWSMan -Force"

RUN pwsh -Command "Install-WSMan"

1 comment:

  1. A smaller/neater working version of the image below is:
    FROM mcr.microsoft.com/dotnet/sdk:3.1-buster

    RUN apt-get update \
    && apt-get install --no-install-recommends -y \
    # required for SSL
    gss-ntlmssp \
    wget \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

    # https://github.com/PowerShell/PowerShell/issues/8548
    # install powershell WSMan.Management module (https://www.bloggingforlogging.com/2020/08/21/wacky-wsman-on-linux/)
    RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
    && dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb \
    && pwsh -Command "Install-Module -Name PSWSMan -Force" \
    && pwsh -Command "Install-WSMan"

    ReplyDelete