Skip to content

Instantly share code, notes, and snippets.

@DzeryCZ
Last active December 9, 2018 22:40
Show Gist options
  • Save DzeryCZ/20706dd2ecb8669d17bcd74dc60fa3b8 to your computer and use it in GitHub Desktop.
Save DzeryCZ/20706dd2ecb8669d17bcd74dc60fa3b8 to your computer and use it in GitHub Desktop.

Revisions

  1. DzeryCZ revised this gist Dec 9, 2018. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions docker-machine-wsl.md
    Original file line number Diff line number Diff line change
    @@ -5,9 +5,7 @@ Add this to ~/.bashrc:
    function docker-machine()
    {
    if [ $1 == "env" ]; then
    docker-machine.exe $1 $2 --shell bash | sed 's/C:/\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g'
    printf "# Run this command to configure your shell:\n"
    printf "# eval \"\$(docker-machine $1 $2)\"\n"
    docker-machine.exe $1 $2 --shell bash | sed 's/C:/\/c/' | sed 's/\\/\//g' | sed 's/"//g'
    else
    docker-machine.exe "$@"
    fi
  2. DzeryCZ revised this gist Oct 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-machine-wsl.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Add this to ~/.bashrc:
    if [ $1 == "env" ]; then
    docker-machine.exe $1 $2 --shell bash | sed 's/C:/\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g'
    printf "# Run this command to configure your shell:\n"
    printf "# eval \"\$(docker-machine $1 $2})\"\n"
    printf "# eval \"\$(docker-machine $1 $2)\"\n"
    else
    docker-machine.exe "$@"
    fi
  3. DzeryCZ revised this gist Oct 24, 2018. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions docker-machine-wsl.md
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,19 @@

    Add this to ~/.bashrc:

    alias windows_docker_machine="/c/Program\ Files/Docker/Docker/resources/bin/docker-machine.exe"
    function docker-machine()
    {
    if [ $1 == "env" ]; then
    $(windows_docker_machine $1 $2 --shell bash | sed 's/C:/\/mnt\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g' )
    docker-machine.exe $1 $2 --shell bash | sed 's/C:/\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g'
    printf "# Run this command to configure your shell:\n"
    printf "# eval \"\$(docker-machine $1 $2})\"\n"
    else
    windows_docker_machine "$@"
    docker-machine.exe "$@"
    fi
    }
    export -f docker-machine


    In case you have mounted C drive to root folder, change `s/C:/\/mnt\/c/` to `s/C:/\/c/` in the script above.
    In case you have not mounted C drive to root folder, change `s/C:/\/c/` to `s/C:/\/mnt\/c/` in the script above.

    Use it like standard docker-machine
  4. DzeryCZ renamed this gist Sep 6, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-machine.md → docker-machine-wsl.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    `docker-machine` Doesnt work properly inside of WSL, this alias makes it work.
    `docker-machine` Doesn't work properly inside of WSL, this function makes it work.

    Add this to ~/.bashrc:

  5. DzeryCZ revised this gist Sep 6, 2018. 2 changed files with 19 additions and 14 deletions.
    14 changes: 0 additions & 14 deletions docker-machine-env.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +0,0 @@
    `docker-machine env` Doesnt work properly inside of WSL, this alias makes it work.

    Add alias to ~/.bashrc:

    docker-machine-env()
    {
    $(docker-machine.exe env $1 --shell bash | sed 's/C:/\/mnt\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g' )
    }

    In case you have mounted C drive to root folder, change `s/C:/\/mnt\/c/` to `s/C:/\/c/` in the script above.

    Use it like this:

    docker-machine-env default
    19 changes: 19 additions & 0 deletions docker-machine.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    `docker-machine` Doesnt work properly inside of WSL, this alias makes it work.

    Add this to ~/.bashrc:

    alias windows_docker_machine="/c/Program\ Files/Docker/Docker/resources/bin/docker-machine.exe"
    function docker-machine()
    {
    if [ $1 == "env" ]; then
    $(windows_docker_machine $1 $2 --shell bash | sed 's/C:/\/mnt\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g' )
    else
    windows_docker_machine "$@"
    fi
    }
    export -f docker-machine


    In case you have mounted C drive to root folder, change `s/C:/\/mnt\/c/` to `s/C:/\/c/` in the script above.

    Use it like standard docker-machine
  6. DzeryCZ revised this gist Aug 7, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-machine-env.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Add alias to ~/.bashrc:
    $(docker-machine.exe env $1 --shell bash | sed 's/C:/\/mnt\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g' )
    }

    In case you have mounted C drive to root folder, change `s/C:/\/mnt\/c/` to `s/C:/\/c/`
    In case you have mounted C drive to root folder, change `s/C:/\/mnt\/c/` to `s/C:/\/c/` in the script above.

    Use it like this:

  7. DzeryCZ revised this gist Aug 7, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions docker-machine-env.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,8 @@ Add alias to ~/.bashrc:
    $(docker-machine.exe env $1 --shell bash | sed 's/C:/\/mnt\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g' )
    }

    In case you have mounted C drive to root folder, change `s/C:/\/mnt\/c/` to `s/C:/\/c/`

    Use it like this:

    docker-machine-env default
  8. DzeryCZ revised this gist Apr 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-machine-env.md
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,4 @@ Add alias to ~/.bashrc:

    Use it like this:

    docker-machine-env default
    docker-machine-env default
  9. DzeryCZ created this gist Apr 26, 2018.
    12 changes: 12 additions & 0 deletions docker-machine-env.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    `docker-machine env` Doesnt work properly inside of WSL, this alias makes it work.

    Add alias to ~/.bashrc:

    docker-machine-env()
    {
    $(docker-machine.exe env $1 --shell bash | sed 's/C:/\/mnt\/c/' | sed 's/\\/\//g' | sed 's:#.*$::g' | sed 's/"//g' )
    }

    Use it like this:

    docker-machine-env default