docker-archive / cloud-integration-beta

Docker CLI with ACI integration (beta)
https://www.docker.com
32 stars 14 forks source link

docker login azure @ WSL2: xdg-open executable file not found in $PATH #20

Closed stefando closed 4 years ago

stefando commented 4 years ago

I am not able to login to azure from WSL2:

docker login azure exec: "xdg-open": executable file not found in $PATH

Client: Docker Engine - Community Azure integration 0.1.7 Version: 19.03.12

Docker Desktop Community Version: 2.3.3.1 (46608) Channel: edge

metcalfc commented 4 years ago

Thanks for this. We'll figure out something native. In the meanwhile one workaround is to use the very nice: https://github.com/4U6U57/wsl-open. Its basically a bash script that can use/mimic xdg-open.

As always you should read the script just to make sure you trust what its going to be doing: https://github.com/4U6U57/wsl-open/blob/master/wsl-open.sh

# Make a bin folder in your home directory
mkdir ~/bin

# Add the bin folder to your PATH in your bashrc
echo '[[ -e ~/bin ]] && PATH=$PATH:~/bin' >> .bashrc

# Download the script to a file named 'wsl-open'
curl -o ~/bin/wsl-open https://raw.githubusercontent.com/4U6U57/wsl-open/master/wsl-open.sh

Now you have two options. Easy or Linux. The easy way is to link ~/bin/xdg-open to ~/bin/wsl-open. This worked for me for a long time. The better way that is more work and takes more space is to actually install the packages that include xdg-open. In Ubuntu that looks like:

sudo apt-get install -y xdg-utils

# now register browser links with wsl-open
wsl-open -w

Hopefully that unblocks you.