Skip to content

Instantly share code, notes, and snippets.

@lure
Last active March 9, 2021 03:58
Show Gist options
  • Select an option

  • Save lure/e529a2fe7d8d8c8619f695e36c7e017a to your computer and use it in GitHub Desktop.

Select an option

Save lure/e529a2fe7d8d8c8619f695e36c7e017a to your computer and use it in GitHub Desktop.

Revisions

  1. lure revised this gist Mar 9, 2021. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions DockerDesktop.MD
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,17 @@
    ## WSL default user and preserve file cetting( ~/.ssh)
    To puth into `/etc/wsl.conf`

    If `chmod` or `chown` takes no effect on files disk should be mounted with metadata like this.
    ```
    [automount]
    options = "metadata"
    ```
    Sometimes WSL decide to start the session as a root. Fix it with this snippet
    ```
    [user]
    default=alex
    ```

    ## Docker-desktop on windows with WSL

    ### No free space on system drive
  2. lure renamed this gist Dec 16, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. lure created this gist Dec 16, 2020.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    ## Docker-desktop on windows with WSL

    ### No free space on system drive
    Let's sat you got windows host with docker desktop and free space on `c:` suddenly disappear.
    Seeking lead you to `%LOCALAPPDATA%/Docker/wsl` where you see `*.vhxd` file of 32gb size. You can not find any relative
    settings in docker-desktop GUI (this is because WSL support is enabled btw), but you want this file to be moved to
    another disk, let's say `e:`

    ### move VHDX file to another disk

    Open command prompt, and there do

    ```
    wsl shutdown
    wsl --export docker-desktop-data e:\dockerdesktop\docker-desktop-data.tar
    wsl --unregister docker-desktop-data
    wsl --import docker-desktop-data E:\dockerdesktop\data\ e:\dockerdesktop\docker-desktop-data.tar --version 2
    ```

    Pay attention that no paths are starting or contain underscores or hyphens or dashes - wsl work really poorly with them and wsl's bash does even worse.
    After all command completed, restart docker desktop, delete `e:\dockerdesktop\docker-desktop-data.tar` you no longer need it.

    ### Sources of dark knowledge:
    how: https://github.com/microsoft/WSL/issues/4320#issuecomment-571758494
    what: https://docs.docker.com/docker-for-windows/wsl/
    why: https://docs.microsoft.com/en-us/windows/wsl/compare-versions#understanding-wsl-2-uses-a-vhd-and-what-to-do-if-you-reach-its-max-size