Product: PowerShell Universal
Version: 1.5.21
Version: 2.9.3
Powershell: 7.2.2
Container: Ubuntu 20.04
Trying to get our container updated to at least Powershell 7.2.2 and Ubuntu 20.04. Works great on my local machine, as always, but when I try to get it up into azure I start running into issues. I think this issue lies with LibGit2Sharp and possibly a missing dependency or incompatible version. I can get the container to run, but when in Azure I’m using Git Sync and it never pulls down my repo. I get this error.
Failed to sync: The type initializer for ‘LibGit2Sharp.Core.NativeMethods’ threw an exception. at LibGit2Sharp.Core.NativeMethods.git_repository_open_ext(git_repository*& repository, FilePath path, RepositoryOpenFlags flags, FilePath ceilingDirs)
Tried with version 1.5.21 and 2.9.3 of PSU same issue on both.
Here is my docker file for reference.
# Docker image file that describes an Ubuntu18.04 image with PowerShell installed from Microsoft APT Repo
ARG fromTag=7.2.2-ubuntu-20.04
ARG imageRepo=mcr.microsoft.com/powershell
FROM ${imageRepo}:${fromTag} AS installer-env
ARG VERSION=1.5.21
ARG PACKAGE_URL=https://imsreleases.blob.core.windows.net/universal/production/${VERSION}/Universal.linux-x64.${VERSION}.zip
ARG DEBIAN_FRONTEND=noninteractive
# Environmental Variables
ENV Data__RepositoryPath=/home/.PowerShellUniversal/Repository
ENV Data__ConnectionString=/home/.PowerShellUniversal/database.db
ENV UniversalDashboard__AssetsFolder=/home/.PowerShellUniversal/Repository/Dashboard
# Install dependencies and clean up
RUN apt-get update
RUN apt-get install openssh-server -y
RUN apt-get install -y tzdata
RUN apt-get install -y apt-utils 2>&1 | grep -v "debconf: delaying package configuration, since apt-utils is not installed"
RUN apt-get install --no-install-recommends -y \
# curl is required to grab the Linux package
curl \
# less is required for help in powershell
less \
# requied to setup the locale
locales \
# required for SSL
ca-certificates \
gss-ntlmssp \
libc6-dev \
# PowerShell remoting over SSH dependencies
openssh-client \
unzip
# Download the Linux package and save it
RUN apt-get install python3 -y
RUN apt-get update
RUN apt-get install python3-pip -y
RUN pip3 install IP2Location
RUN echo ${PACKAGE_URL}
RUN curl --insecure -sSL ${PACKAGE_URL} -o /tmp/universal.zip
RUN unzip /tmp/universal.zip -d ./etc/Universal || :
# remove powershell package
RUN rm /tmp/universal.zip
RUN chmod +x ./etc/Universal/Universal.Server
# Install OpenSSH and set the password for root to "Docker!".
RUN mkdir -p /run/sshd
RUN echo "root:Docker!" | chpasswd
# Install PSWSMan - for Exchange Powershell Connections
RUN pwsh -C "Install-Module -Name PSWSMan -Force -Scope AllUsers"
RUN pwsh -C "Install-WSMan"
# Copy the sshd_config file to the /etc/ssh/ directory
COPY sshd_config /etc/ssh/
COPY init_container.sh ./
RUN chmod 755 ./init_container.sh
# Port to expose
EXPOSE 5000 2222
# Path to execute
ENTRYPOINT "./init_container.sh"