Run Oracle Container Image using WSL Container

With version 2.9.3 of the Windows Subsystem for Linux (WSL), Microsoft introduced the possibility to run Linux containers natively on Windows without the need to install additional software. In this blog post I will use WSL Container to run an Oracle Database 26ai container image provided by Gerald Venzl.

Prerequisities

As mentioned, the minimum version of WSL is 2.9.3. You can check and if required update the version of WSL using the following two commands in PowerShell. Run the update with administrator rights.

PS> wsl --version
WSL version: 3.0.1.0
Kernel version: 6.18.40.1-1
WSLg version: 1.0.79
MSRDC version: 1.2.7214
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.7582 

PS> wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

Command-line Tool

To manage the container and images, the binary wslc.exe or its alias container.exe has to be used. It provides the well-known docker/podman commands.

PS> wslc --help
Copyright (c) Microsoft Corporation. All rights reserved.
For privacy information about this product please visit https://aka.ms/privacy.

WSLC is the Windows Subsystem for Linux Container CLI tool. It enables management and interaction with WSL containers from the command line.

Usage:  wslc [global-options] [<command>] [options]

Commands:
  container  Manage containers.
  image      Manage images.
  network    Manage networks.
  registry   Manage registry credentials.
  settings   Open the settings file in the default editor.
  system     System-level commands
  volume     Manage volumes.
  attach     Attach to a container.
  build      Build an image from a Dockerfile.
  create     Create a container.
  exec       Execute a command in a running container.
  events     Monitor container events.
  export     Export a container's filesystem as a tar archive.
  images     List images.
  import     Import an image from a tarball.
  info       Display system information.
  inspect    Inspect objects.
  kill       Kill one or more running containers.
  list       List containers.
  load       Load images.
  login      Log in to a registry.
  logout     Log out from a registry.
  logs       View container logs.
  pull       Pull images.
  push       Upload an image to a registry.
  remove     Remove containers.
  restart    Restart containers.
  rmi        Remove images.
  run        Run a container.
  save       Save images.
  start      Start a container.
  stats      Display container resource usage statistics.
  stop       Stop containers.
  tag        Tag an image.
  version    Show version information.

For more details on a specific command, pass it the help option. [-?]

Options:
  -v  --version  Show version information for this tool
  -?  --help     Shows help about the selected command

Global Options for 'wslc':
      --session  Specify the session to use

The binary has also a context-aware help to get more details and parameters for specific commands.

PS> wslc image pull --help
Copyright (c) Microsoft Corporation. All rights reserved.
For privacy information about this product please visit https://aka.ms/privacy.

Pulls images.

Usage:  wslc image pull [options] <image>

Aliases:
  wslc image pull, wslc pull

Arguments:
  image  Image name

Options:
  -a  --all-tags  Download all tagged images in the repository.
  -q  --quiet     Suppress verbose output
  -?  --help      Shows help about the selected command

Global Options for 'wslc':
      --session   Specify the session to use

Handle Container Images

To list all already downloaded container images, use wslc image ls.

PS> wslc image ls
REPOSITORY           TAG      IMAGE ID       CREATED       SIZE
ubuntu               latest   5a0b35d45050   2 weeks ago   100MB

A new container image from an external source can be pulled as followed. As example I use the container image gvenzl/oracle-free and the tag 23-slim provided by Gerald Venzl. For more details please have a look at the documentation https://hub.docker.com/r/gvenzl/oracle-free.

PS> wslc image pull gvenzl/oracle-free:23-slim
23-slim: Pulling from gvenzl/oracle-free
4a89c51c0a93: Pull complete
7de834c3d18e: Pull complete
8752dc7faca6: Pull complete
a59acea35b2b: Pull complete
b0bfbf99b20a: Pull complete
0478c6754a70: Pull complete
Digest: sha256:6d61d267a3b978c24c5ac1790e62e927416a0aec446bd86e4b3a1527562757bd
Status: Downloaded newer image for gvenzl/oracle-free:23-slim
docker.io/gvenzl/oracle-free:23-slim

To get rid of a container image, use wslc image remove.

PS> wslc image remove gvenzl/oracle-free:23-slim
Untagged: gvenzl/oracle-free:23-slim
Untagged: gvenzl/oracle-free@sha256:6d61d267a3b978c24c5ac1790e62e927416a0aec446bd86e4b3a1527562757bd
Deleted: sha256:41bcf6415d3a89ac19c00687da8714e5c996d8c652ed989e0d46f8ddafc47c27
Deleted: sha256:421ad14bd8ad24bf012996aa6a60ad99060d08946778667d30fb0cc5cdee4ed4
Deleted: sha256:887b0e7a46929e5905afa8a60d9c037e65002ac3af45790557b5179dffba5b4e
Deleted: sha256:2fa922a0eb059fbcb2910de955ecd413c2c321fa47daab17c694b5ed384c22e3
Deleted: sha256:eedb9917e1ad3066df02bda0032ef2b27d0fa401dbb87cf34846ddf4e78816e6
Deleted: sha256:96beaaddff366abd1bac0f9f0018530c8d1cae849730943ef5c3555e0d398c8d
Deleted: sha256:4e3ea2befacfcc1cd222d0dcc755a7988e89cdf1e5297bb5f00734ebe481b9cd

Run a Container

The following command will start a new container with the name 26ai-slim using the previously mentioned container image. As the container image was deleted, it is automatically downloaded again.

INFO: Without the option --detach you will see how the database is created and started. At the end a tail of the alert log is executed and the connection to the container stays open.

PS> wslc run --detach --name "26ai-slim" -p 1521:1521 -e ORACLE_RANDOM_PASSWORD="y" gvenzl/oracle-free:23-slim
Image 'gvenzl/oracle-free:23-slim' not found, pulling
23-slim: Pulling from gvenzl/oracle-free
4a89c51c0a93: Pull complete
7de834c3d18e: Pull complete
8752dc7faca6: Pull complete
a59acea35b2b: Pull complete
b0bfbf99b20a: Pull complete
0478c6754a70: Pull complete
Digest: sha256:6d61d267a3b978c24c5ac1790e62e927416a0aec446bd86e4b3a1527562757bd
Status: Downloaded newer image for gvenzl/oracle-free:23-slim
eb2fd0feb9c8ab63267c9c9277ee8d06a30e4b3fa9500dd79e03940a973c254d

With wslc container ps/list you can get an overview of all running containers.

PS> wslc container ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED              STATUS              PORTS                      NAMES
eb2fd0feb9c8   gvenzl/oracle-free:…   "container-entrypoin…"   About a minute ago   Up About a minute   127.0.0.1:1521->1521/tcp   26ai-slim

You can now use for example SQL Developer to connect to the database remotely or wslc exec to connect to the container to use SQL*Plus to locally connect to the database.

PS> wslc exec -it 26ai-slim sh
sh-4.4$ sqlplus / as sysdba

SQL*Plus: Release 23.26.3.0.0 - Production on Thu Oct 1 08:37:34 2026
Version 23.26.3.0.0

Copyright (c) 1982, 2026, Oracle.  All rights reserved.


Connected to:
Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free
Version 23.26.3.0.0

SQL> col host_name for a20
SQL> SELECT instance_name, host_name, version_full FROM v$instance;

INSTANCE_NAME    HOST_NAME            VERSION_FULL
---------------- -------------------- -----------------
FREE             eb2fd0feb9c8         23.26.3.0.0

To remove the (running) container use wslc container remove with the force option.

PS> wslc container remove --force "26ai-slim"
26ai-slim

Conclusion

If you are already using Windows Subsystem for Linux, this new feature is a great enhancement. No need to install additional software like docker to quickly run a container image. During my tests I didn’t run into issues and the execution of the containers was stable.

References

Leave a Reply

Your email address will not be published. Required fields are marked *