Docker on Windows on WSL2

Thanks to a ton of help from @Kevin.Collins I was able to achieve a pretty good Docker setup on my Windows 10 laptop. Following are the main steps I followed:

  1. Enable WSL for Windows (Windows Features)

  2. Install Linux images (Microsoft App Store - I used Ubuntu 20.04 LTS)

  3. Make sure WSL version 2 is running
    wsl -l -v (from powershell to determine the version)
    wsl --set-default-version 2 (from powershell to set version to 2)

  4. Install Docker Desktop (for Windows) - this will also install Docker on the linux image and “set everything up to work pretty well”. I tried for a long time use Docker installed directly on the linux image, but was never able to launch the designer or clients from the Windows host.

  5. Enable WSL Integration from the Docker Desktop Settings page.

  6. Pull an image from Kevin’s Docker Hub. I did this from a linux command line.

  7. Create a container with the image, once again from a linux command line.
    docker run -p 9088:8088 -v test_vol:/var/lib/ignition/data --name test_ign -e GATEWAY_ADMIN_PASSWORD=password -e IGNITION_EDITION=full -e TZ='America/New_York' -d kcollins/ignition:8.0.3
    — 9088 is the port to use from Windows to connect the the gateway, designer, and clients
    — test_vol is the name of the directory that will contain /var/lib/ignition/data. This folder can be found on the Windows box at \\WSL$\docker-desktop-data\version-pack-data\community\docker\volumes while Docker is running.
    America/New_York is the timezone that the container will use.

Some improvements that I would prefer but have not been able to figure out:

  1. Mount the volume on the “main” Linux area, namely somewhere like /home/user_dir/project_name so that it is available even when Docker is not running.
  2. Eliminate the need for Docker Desktop and have the ability to launch the Designer from the Windows host.
2 Likes

Great write-up @mcgheeiv! One tip that I’ll share is that you can use Visual Studio Code, and specifically the Remote Extensions to open an editor (from your host Windows machine) into your Docker container, and thusly into that volume you’ve got mounted at /var/lib/ignition/data. It is a really great way to pop into the container filesystem in a user friendly way!

1 Like