microsoft / mssql-scripter

Repository for the new SQL cross-platform command line tools
Other
740 stars 148 forks source link

Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. #276

Open mattAWL opened 1 year ago

mattAWL commented 1 year ago

Hi all I was very curious to use the mssql-scripter, so I created a docker container image containing this tool. But when I want to run a backup, there is following exception thrown: (I also get the same error when I replace the environment variables with explicit values)

root@somecontainerg:/# mssql-scripter -S ${MSSQL_HOST} -d ${MSSQL_DATABASE} -U ${MSSQL_USER} -P ${MSSQL_PASSWORD} --schema-and-data  > /tmp/dump.sql
FailFast:
Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.

   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.StringComparer..cctor()
   at System.AppDomain.InitializeCompatibilityFlags()
   at System.AppDomain.Setup(System.Object)

I already tried to add the libicu-dev package to my Dockerfile:

# add package to fix ICU
RUN apt-get install -y libicu-dev

My Dockerfile:

FROM ubuntu:22.10
LABEL maintainer="xxx"

RUN apt-get update -y && apt-get install -y python3 && apt-get install -y python3-pip && apt-get install -y curl
#add fix for python: command not found
RUN apt-get install -y python-is-python3
# add package to fix ICU
RUN apt-get install -y libicu-dev
RUN pip3 install awscli
RUN pip3 install mssql-scripter

ADD run.sh run.sh
ADD backup-s3.sh backup-s3.sh
ADD backup-local.sh backup-local.sh

CMD ["sh", "run.sh"]

What could the issue here? Do I also need to add .net runtime inside the docker container?

msshapira commented 1 year ago

I managed to get docker working here: https://github.com/microsoft/mssql-scripter/pull/275

mattAWL commented 1 year ago

I managed to get docker working here: #275

Thanks for your hint! I will take a look. But I need to get it running in a ubuntu or alpine container since I want to do backups with cron and store them on a S3 bucket.