Skip to content

Instantly share code, notes, and snippets.

@smuuf
Created February 23, 2025 16:47
Show Gist options
  • Save smuuf/cf84ee9fcaaef40920ce3f12230a5e4a to your computer and use it in GitHub Desktop.
Save smuuf/cf84ee9fcaaef40920ce3f12230a5e4a to your computer and use it in GitHub Desktop.
WSL1 docker client with WSL2 docker daemon

WSL1 docker client with WSL2 docker daemon

  1. Install Docker engine in both WSL1 and WSL2.
  2. In WSL1: Create, configure and use new context:
    $ docker context create wsl2daemon
    $ docker context update --docker "host=tcp://[::]:2375" wsl2daemon
    $ docker context use wsl2daemon
    
  3. In WSL2: Configure the daemon in /etc/docker/daemon.json:
    {
      "hosts": ["tcp://[::]:2375"]
    }
    
  4. Start (or restart) Docker daemon in WSL2.
  5. Run docker info in WSL1 (you might need to wait a bit for daemon in WSL2 to fully initialize).
  6. Profit 💸
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment