Skip to content

Instantly share code, notes, and snippets.

@Cenness
Created April 17, 2022 17:21
Show Gist options
  • Save Cenness/e4bc824d9af663f0eac7b51f1a6c297a to your computer and use it in GitHub Desktop.
Save Cenness/e4bc824d9af663f0eac7b51f1a6c297a to your computer and use it in GitHub Desktop.

Revisions

  1. Cenness created this gist Apr 17, 2022.
    34 changes: 34 additions & 0 deletions docker-in-wsl2.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    ### host cmd - elevated
    Update to WSL2
    ```
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    ```
    Restart host.
    This will take a while:
    ```
    wsl --set-default-version 2
    wsl --set-version Debian 2
    ```
    ### nix
    ```
    sudo apt remove docker docker-engine docker.io containerd runc
    sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common iptables -y
    sudo touch /etc/fstab
    sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
    sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
    curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
    sudo apt-key fingerprint 0EBFCD88
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
    sudo apt update
    sudo apt install docker-ce docker-ce-cli containerd.io -y
    sudo usermod -aG docker $USER
    ```
    ### host cmd - elevated
    ```
    wsl.exe -t Debian
    ```
    ### nix
    ```
    sudo service docker start
    ```