dragon is a CLI tool that you can use to create and update Windows Subsystem for Linux 2 VMs from Docker images/containers.
dragon is intended to be used in the context of development-environments-as-code as described in project-dev-palace but it can be used just as a simple tool to manage WSL VMs created from Docker containers.
Go to the Releases page and download the Windows x86_64 binary.
- start with
dragon newto create a WSL VM from a Docker image from a public or private registry. This creates a record in a config file called .dockerwsl, pulls the image locally, creates a WSL VM from it and adds a profile in the Windows Terminal settings.json file. When this is done, you should see the VM in the list of Windows Terminal shells and be able to connect to it. WARNING: it will remove all comments from thesettings.json file! - periodically run
dragon update. Available only for ACR hosted Docker images. It uses theazCLI to determine the most recent tag, which then puts in the.dockerwslconfig file in thelatestproperty for that WSL. - periodically run
dragon upgrade, which creates a new WSL VM from the tag specified in thelatestproperty. WSL VMs are named using the WSL name provided and the tag. Iflatestpoints to a new tag, then a new VM is created with the newname. Iflatestis the same, then the VM is replaced. - run
dragon runto connect to a WSL VM. It is used in the Windows Terminal profile to connect to the VM.
For convenience, set the following environment variables:
DOCKERWSL_PATH- location of the .dockerwsl file. It is created if it doesn't exist.WT_SETTINGS_PATH- location of the Windows Terminal settings.json file.AZ_CLI_PATH- location of theaz.cmdbinary. Only needed fordragon update.
dragon is using several tools that need to be installed on the machine it will run on:
azCLI is needed fordragon update. The path to the CLI binary needs to be passed as a parameter to the command or aAZ_CLI_PATHenvironment variable needs to be set.wslCLI is used fordragon upgradeto list, delete and import VMs.dockerCLI and Desktop need to be available. Used for pulling images, creating containers from images and exporting them to tars.- Windows Terminal settings.json file.
dragon newtries to create a new profile in the Windows Terminal settings file.
- Implement
dragon cleanupthat deletes all WSL VMs except the last version - Make Windows Terminal profile creation optional.
dragon removeto delete WSLs from .dockerwsl file, WSL VMs and profile from Windows Terminal settings.json.- Not use
azCLI