Skip to content

feat: add wsl support (Docker Desktop)#2

Open
e00dan wants to merge 1 commit intoaxonweb3:mainfrom
e00dan:feat/wsl-support
Open

feat: add wsl support (Docker Desktop)#2
e00dan wants to merge 1 commit intoaxonweb3:mainfrom
e00dan:feat/wsl-support

Conversation

@e00dan
Copy link
Copy Markdown

@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

Comment thread src/docker.rs
let wsl_path: String;

if is_wsl() {
wsl_path = wslpath::wsl_to_windows(&self.path.to_owned()).unwrap().to_owned().replace("/", "\\");
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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