Windows Containers - culture settings - windows

I need to run a legacy application on my computer, which requires a specific culture setting in Windows in order to work. I do not want to change the global culture settings in Windows in order to accommodate this application
I could run it in a Virtual Machine, but I would prefer to run it in a Docker Windows Container instead, if possible.
Is it possible to configure a specific culture for an application running in a Docker Windows Container, and how is this done?

Microsoft publishes tags for base images for all the supported cultures: https://hub.docker.com/r/microsoft/windowsservercore/tags/
So I think you can just base yourself on the culture that you want.
In addition, have you tried Set-Culture?
https://technet.microsoft.com/en-us/itpro/powershell/windows/international/set-culture

There is a working trick for this problem:
docker run --name temp-container --user "NT AUTHORITY\SYSTEM" --isolation=process your-image:your-tag powershell Set-Culture en-AU
docker commit temp-container your-image:your-tag
docker rm temp-container
Now you can start your image:
docker run --rm -it --isolation=process your-image:your-tag powershell
And you will have culture 'en-AU'

Related

How are Docker Desktop proxy settings on Windows propagated to Docker?

I am on a corporate Windows laptop and I want to start experimenting with Docker. Being a corporate machine, everything needs to go through the corporate proxy.
I installed Debian on WSL and then the Docker Desktop, which installed its components on the Debian WSL VM. My first priority however was to test docker on WSL directly and not through Docker Desktop. So I set to read the Docker docs and download the docker/getting-started image through the Debian terminal. That, however, failed due to not using the network proxy.
Desktop Docker docs state that setting the proxy settings on Docker Desktop will propagate the proxy settings to Docker itself. Indeed, I set the proxy settings on Docker Desktop, and I was now able to properly download my image from inside Debian.
Since I want to have full control of Docker through the Debian terminal and not Docker Desktop, I want to understand in which way the proxy settings propagate to Docker inside WSL. I imagined that Docker Desktop altered some configuration file inside Debian, but a grep on the whole system of the proxy ip got me nothing. So my question is, in what way does the Docker Desktop let Docker know which proxy to use?
As much as I know, And am not 100% sure as I have not worked with docker in a while.
When you start docker service in WSL, this will trigger the init.d/docker script, And when you set the Company proxy manually in docker desktop, The loading time is :
Stopping Docker service
Updating configuration Script at /etc/init.d/docker
Starting the service again, and with it the new script
And to make sure that this is valid, You can try to check the /etc/init.d/docker script contents.
and as an alternative way of not adding the scripts manually. you can export the proxy configuration in WSL, and check if it will work without adding the proxy configuration to Docker Desktop.

Run Quarkus tests with TestContainers using WSL2 + Podman

With the license change for Docker Desktop on Windows, I'm looking for an alternative. Podman + WSL2 seems to do the trick for me. Except for Testcontainers in my Quarkus tests.
I'm able to run my tests within WSL2 by starting podman system service in WSL2 (podman system service -t 0 tcp:localhost:8880) and setting the DOCKER_HOST env var (DOCKER_HOST=tcp://localhost:8880).
Now this works, but isn't really what I need, since at my company we develop in VSCode, IntelliJ and Eclipse. I'd like to be able to run the tests from within those IDE's. Is there any way to pass the podman uri (from WSL) to my IDE in Windows while running Quarkus tests?
If anyone would know any other docker desktop alternatives that work with TestContainers, that would be awesome as well. I have tried Rancher Desktop, but it gets stuck and the tests eventually time out.
You have to install podman-remote packages on your windows host machine, then configure it to use tcp://WSL2_IP:8880 (podman documentation) and finally make an alias for the program docker -> podman.exe.
Now you are able to run docker commands as usual... docker ps docker run etc. But it does not mean that all tools will work out of the box. You have to tune it.
For example for testcontainers you have to set env variables on host machine:
PowerShell
[System.Environment]::SetEnvironmentVariable("DOCKER_HOST", "tcp://WSL2_IP:8880", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("TESTCONTAINERS_CHECKS_DISABLE", "True", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("TESTCONTAINERS_RYUK_DISABLED", "True", [System.EnvironmentVariableTarget]::User)
P.S. All that kind of variables were set for you by docker, but from now you have to do it by yourself.
We ran the testcontainers-java tests using various solutions for Docker.
I don't know if running in WSL changes a lot compared to the Windows only setup.
In general, Testcontainers doesn't rely only on the CLI commands only and works best with compatible Docker environments. Based on the findings in that experiment, you can try minikube.
enter image description hereTake IntelliJ for example, you can set DOCKER_HOST env var by "Run/Debug Configurations" and it works perfectly.

Docker container settings to mimic Linux Systemd service

This is a question relating to configuring Docker on Linux to ensure the best performance. I'm wondering what settings / command-line flags need to be passed to a docker run command to ensure that the container runs as closely as possible to its equivalent on systemd ?
Would this simply be --privileged and --net host ? How would these settings passed to a Docker container compare (in terms of performance) to the same service running on systemd ?
Thank you!

kubernetes forcing docker option for container

Is it possible to make sure that my containers are running with specific docker option.
I need to run my container with the --device option. I cannot use device plugin because I am running a windows container and device manager does not seems implemented for windows.
Thank you for your help

Graphic output from Windows docker container

my goal is to run Windows container with a desktop app (EXE) installed inside, having its own GUI (CAD).
It's not a problem to build the container, installing silently the app, however I cannot realize how its output (GUI) would be redirect/catch up in Windows docker host to interact with it.
Digging web I found DISPLAY envvar setting for Linux container, but nothing for Windows' one.
I cannot believe it's impossible to get graphic output from Windows Container.
Please help,
Thanks in advance!
Yes, unfortunately docker containers are not designed for GUI using. It possible if only your app is accessible through web browser
you need XServer, running on windows host machine
for example, install VcSrv https://sourceforge.net/projects/vcxsrv/
run it, then see ipconfig in console
find vEthernet ipv4
my ipconfig
use it when run docker container, for example try
docker run --rm -it --net=host -e DISPLAY=172.22.96.1:0 stefanscherer/xeyes
in env DISPLAY set your ipv4 from vEthernet in ipconfig

Resources