Skip to content

Instantly share code, notes, and snippets.

@thatkookooguy
Created January 6, 2021 21:41
Show Gist options
  • Save thatkookooguy/fdfad714c7cb550f1b11b6b22eb4e61d to your computer and use it in GitHub Desktop.
Save thatkookooguy/fdfad714c7cb550f1b11b6b22eb4e61d to your computer and use it in GitHub Desktop.

In order to deploy things and use docker from INSIDE wsl2

on windows, run the following command:

docker run -d --name unix-connect --restart=always -p 127.0.0.1:23750:2375 -v /var/run/docker.sock:/var/run/docker.sock  alpine/socat  tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock

Then, add this line at the end of your .zshrc or .bashrc file:

export DOCKER_HOST=tcp://127.0.0.1:23750

Launch a new terminal or source the file we updated, and now you should see your containers when running docker ps inside wsl2

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