Docker Community Forums

Share and learn in the Docker community.

$PATH in wsl2 shell does not include docker or vs code


I’ve just installed Docker Desktop on a new Windows 10 pro install. Curiously, whilst I can start containers from a windows command shell, when I open a wsl shell I find that:

  • docker and docker-compose are not in my path
  • code is not in my path

so I do

#  echo $PATH

which appears to show that the windows path is not being appended to my path.

Note I have not installed any linux distro, just docker desktop and wsl2.

If you want to use Docker with WSL2 you do need to install a linux distro from the windows store. What you currently have is just something that ensures Docker Desktop can start. Yes you can use docker from the command line in Windows but that’s basically all functionality you are getting.

If you’d install for example Ubuntu 20.04 LTS you get all the functionality. Use docker from within WSL, install VS Code so it can connect to your WSL and do the things with Docker.