Skip to content

Instantly share code, notes, and snippets.

@DzeryCZ
Last active December 9, 2018 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DzeryCZ/20706dd2ecb8669d17bcd74dc60fa3b8 to your computer and use it in GitHub Desktop.
Save DzeryCZ/20706dd2ecb8669d17bcd74dc60fa3b8 to your computer and use it in GitHub Desktop.
Make docker-machine works properly on WSL

docker-machine Doesn't work properly inside of WSL, this function makes it work.

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'
    else
            docker-machine.exe "$@"
    fi
}
export -f docker-machine

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment