Article
· Dec 8, 2023 3m read

Running IRIS Community docker image as a WSL 2 machine

Windows Subsystem for Linux (WSL) is a feature of Windows that allows you to run a Linux environment on your Windows machine, without the need for a separate virtual machine or dual booting. 

WSL is designed to provide a seamless and productive experience for developers who want to use both Windows and Linux at the same time**.

WSL 2 is the default distro type when installing a Linux distribution. WSL 2 uses virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). Linux distributions run as isolated containers inside of the WSL 2 managed VM. Linux distributions running via WSL 2 will share the same network namespace,  device tree (other than /dev/pts), CPU/Kernel/Memory/Swap, /init binary, but have their own  PID namespace, Mount namespace, User namespace, Cgroup namespace, and init process.

WSL 2 increases file system performance and adds full system call compatibility in comparison to the WSL 1 architecture.

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker's methodologies for shipping, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production .****

 

Here we will learn how to easily migrate the Community Edition of IRIS Docker image to WSL 2.

 

Export the tar from a container

Open the command line (Bash) for a Linux distribution that you've already installed from the Microsoft Store (CentOS Stream in this example, for Ubuntu the commands are the same apart from using service instead of systemctl).

Start the Docker service:

sudo systemctl docker start

 

Pull the image from DockerHub:

docker pull intersystems/iris-community:2023.3

 

Run the IRIS container inside Docker:

docker run intersystems/iris-community:2023.3

 

Grab the IRIS container ID using grep and awk (from a different WSL tab, recommended):  

Optional to stop the docker container before this step, however if you don't you will only need to stop/start the instance once imported to WSL

dockerContainerID=$(docker container ls -a | grep -i iris | awk '{print $1}')

 

Export the container ID to a tar file on your mounted c-drive:

docker export $dockerContainerID > /mnt/c/temp/iris_community.tar

 

 

Importing IRIS Community example

Open PowerShell and ensure that you have a folder created where you'd like the distribution to be stored.

cd C:\temp

 

mkdir C:\Users\csepulvedamancilla\wslDistroStorage\IRIS

 

Use the command wsl --import <DistroName> <InstallLocation> <InstallTarFile> to import the tar file.

 wsl --import IRISCommunity C:\Users\csepulvedamancilla\wslDistroStorage\IRIS .\iris.tar

Use the command wsl -d IRISCommunity to run your newly imported Linux distribution.

 

 wsl -d IRISCommunity

Once connected, launch IRIS  (Pro tip, do it with wsl.conf!)

su - irisowner

 

iris start IRIS

 

 

Enjoy your instance!

http://localhost:52773/csp/sys/%25CSP.Portal.Home.zen

 

You can now enjoy all the performance benefits, flexibility and native integration of WSL2 (aka, direct access to the files, tail those logs!, copy java drivers and more) while using your IRIS Community instance.

 

** https://learn.microsoft.com/en-us/windows/wsl/about

 

*** https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro

 

**** https://docs.docker.com/get-docker/

Discussion (0)0
Log in or sign up to continue