You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to install Code-Server using the installation script and had this error:
Failed to connect to bus: No such file or directory
That is related to systemd and WSL2 (WSL and WSL2 don't support systemd, the PID 1 is Init).
Then, I've tried the Code-Server manual installation and every time I open WSL terminal I have to run:
$ code-server
info Using config file ~/.config/code-server/config.yaml
info Using user-data-dir ~/.local/share/code-server
info code-server 3.4.1 44f7c2724827e526eeaa6c2c151c520f48a61222
info HTTP server listening on http://0.0.0.0:8001
info - Using password from ~/.config/code-server/config.yaml
info - To disable use `--auth none`
info - Not serving HTTPS
Is there any option to start Code-Server when Windows/WSL starts?
Is running Code-Server in Docker inside WSL2 an option?
When he asked to create a file in the directory on the domain, I used MiniWeb HTTP server.
3. I took the port forwarding .ps1 script for WSL2, and changed $ports to 443, and $addr to my local IPv4 (from ipconfig).
4. Made a bat script to run everything at once. (Don't forget to change your data instead of <>)
We just started using GitHub Discussions. Would you be able to share this on "Show and Tell" as well? I think it will help others with the same problem
Another FYI -- I was playing around last night with WSL2 Docker Containers on Windows.
It's actually really freaking easy to spin up code-server via the container; I'm working on some simple scripting to iron out the edges and should have that ready in a couple days.
Turns out that it's really easy to add an automatic UPNP firewall port mapping, so that it can be exposed past the NAT without having to manually configure the router firewall, and by just mapping the one port thru the host, this gets stupid kinds of simple. I'm crafting a script for this, I'll be back in a day or two.
# Quick & Dirty powershell script to use the containter with Docker & WSL2 containers.# Run this wherever you want the folder created and mapped to.# create a folder in the current directory
cd (mkdir -ea 0 code-server)
# create the '.config' and 'project' folders in the current location.
mkdir -ea 0 .config,project
# reformat the current folder as a unix-style path $LOC="/$(((pwd).path).substring(0,1).tolower()+((pwd).path).substring(1))"-replace'\\','/'-replace':',''# Run the docker image, map it back to port 8080 on the host, and map the .config and project folders
docker run -it --name code-server -p 127.0.0.1:8080:8080-v "$LOC/.config:/home/coder/.config"-v "$LOC/project:/home/coder/project" codercom/code-server:latest -e PASSWORD=Hi-Mom!
I may just roll the whole thing up into an extended docker image with a few parameters.
Activity
code-asher commentedon Jul 7, 2020
I don't have any personal experience with autostarting services on WSL, but this looks like what you're looking for: https://superuser.com/questions/1343558/how-to-make-wsl-run-services-at-startup/1365978
I'll close the issue but feel free to continue posting here.
iHackFX commentedon Aug 2, 2020
How I run the
code-serverin WSL2 (Ubuntu 20.04) with port forwarding and SSL:systemctl --user restart code-serverWhen he asked to create a file in the directory on the domain, I used MiniWeb HTTP server.
3. I took the port forwarding .ps1 script for WSL2, and changed
$portsto 443, and$addrto my local IPv4 (from ipconfig).4. Made a bat script to run everything at once. (Don't forget to change your data instead of <>)
If you need autorun
Make the following .vbs file and place in
Win-R -> shell:startup. (Don't forget to change your data instead of <>)bpmct commentedon Aug 20, 2020
@iHackFX I love the detailed explanation!
We just started using GitHub Discussions. Would you be able to share this on "Show and Tell" as well? I think it will help others with the same problem
fearthecowboy commentedon Sep 21, 2020
FYI - I have a quick & dirty write up how I did code-server on WSL2:
https://fearthecowboy.com/tutorial/2020/09/17/Code-Serrver-On-WSL.html
fearthecowboy commentedon Oct 21, 2020
Another FYI -- I was playing around last night with WSL2 Docker Containers on Windows.
It's actually really freaking easy to spin up
code-servervia the container; I'm working on some simple scripting to iron out the edges and should have that ready in a couple days.Turns out that it's really easy to add an automatic UPNP firewall port mapping, so that it can be exposed past the NAT without having to manually configure the router firewall, and by just mapping the one port thru the host, this gets stupid kinds of simple. I'm crafting a script for this, I'll be back in a day or two.
I may just roll the whole thing up into an extended docker image with a few parameters.