Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add wsl support (Docker Desktop) #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

e00dan
Copy link

@e00dan e00dan commented Sep 7, 2022

  1. In Docker Desktop enable "Expose daemon on tcp://localhost:2375 without TLS"
  2. Find out your Host IP: https://docs.microsoft.com/en-us/windows/wsl/networking#accessing-windows-networking-apps-from-linux-host-ip
  3. Run Windows PowerShell in Administrator mode and run:
netsh interface portproxy add v4tov4 listenport=2375 listenaddress=<YOUR_HOST_IP> connectaddress=127.0.0.1 connectport=2375
  1. Create rule in Windows Defender Advanced Settings to open port 2375
  2. Run curl http://<YOUR_HOST_IP>:2375/images/json in WSL to see if accessing remote Docker API works.
  3. cargo build && DOCKER_API_URL=tcp://<YOUR_HOST_IP>:2375 ./target/debug/axon-cli

Works:
image

let wsl_path: String;

if is_wsl() {
wsl_path = wslpath::wsl_to_windows(&self.path.to_owned()).unwrap().to_owned().replace("/", "\\");
Copy link
Contributor

@wenyuanhust wenyuanhust Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you running docker on Windows instead of WSL?
I tried this branch on Ubuntu 20.04 of WSL2 for Window10. And, I started docker on my WSL2. After running axon start command by axon-cli. I got the following error msg:

Error: error 400 Bad Request - create \wsl$\Ubuntu-20.04\root.axon/devtools: "\\wsl$\Ubuntu-20.04\root\.axon/devtools" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path

If I run the main branch of axon-cli, it works fine.

Copy link
Author

@e00dan e00dan Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you install Docker on WSL using https://www.docker.com/products/docker-desktop/ or did you install it in custom way?

I'm running Docker Desktop on WSL with exposed Remote API port from Windows host (it was unreachable otherwise)

Copy link
Contributor

@wenyuanhust wenyuanhust Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure cause I installed Docker long time ago.
But I didn't install Docker on my Win10 machine. Looks like I installed Docker for Ubuntu in custom way.
By the way, I'm using WSL2 instead fo WSL.

@e00dan e00dan changed the title feat: add wsl support feat: add wsl support (Docker Desktop) Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants