If you're using Ubuntu 22.04 or Debian 10 / 11 you'll need to make 1 small change from the video. You'll need to run `sudo update-alternatives --config iptables` and choose option (1) from the prompt to install the legacy version of iptables. Once that's installed everything else works 100% the same and Docker will start successfully.
Thanks for taking the time to explain the ins and outs of this. I did not even know we had a choice. I just re-installed my 3 year old 9570 and chose to stay away from DDesktop. Volumes really seem faster. One small thing I will miss is the neat log/terminal pane in the DDesktop container GUI. But Docker Desktop feels like a nuclear powerplant in terms of footprint and I can probably easily add some aliases to my .bashrc to the same effect. On a side note: you mention that your workstation has 16G of RAM. I do not know the type of workflows that you're running, but I have a 32G and 64G machine and the 32G machine sometimes runs a bit short on memory (WSL2 eats memory like pandas on a bamboo gobbling spree) .
Hi, WSL 2 has issues around not releasing memory and disk space. A few years ago I made a video on how to clear your memory and disk space at: th-cam.com/video/4PwClrUCqJM/w-d-xo.html, it still applies today. With Docker running directly in the WSL 2 instance you'll want to follow the disk space steps from time to time too.
No problem. It does support systemd but it's very unstable, or at least it was a few months ago. If you close your terminal the process would crash or stop after a pretty short amount of time, meaning you'd have to wait for Docker to spin up again when you close your terminal. The method used in this video doesn't have that problem. It stays up until you reboot your machine or kill the whole WSL process.
Hi Nick, great vid! is there still a way to avoid using WSL and docker desktop ? aren't there any installers meant to be install docker on windows without WSL ?
Thanks. I think you can still use the Hyper-V backed Docker Desktop if you wanted to avoid WSL 2 but WSL 2 nowadays is just a Windows app that you can optionally install. If you want to avoid all of that you can manage your own custom Linux based VM.
Hi, great video. It worked fine for me. One extra thing, will there be any way to run docker, with all the previous configuration, but without entering the WSL console? It is that my project is in the windows folders, and the idea is to run docker from the terminal from where the docker-compose document is hosted. Thanks a lot.
Thanks. In this case Docker is installed and running in WSL. You can access Windows files from within WSL. By default your drives will be mounted in the /mnt folder, so you can run something like `cd /mnt/c` if you have a C:\ drive on Windows. Although the volume mount performance using this method will be very slow compared to having files directly in WSL. By the way you can access WSL files in Windows too. You can open a Windows explorer window and goto `\\wsl.localhost\Ubuntu` , assuming you're running Ubuntu in WSL.
I was hoping in my head that it could be run transparently as in docker-desktop, but I'll settle for that information. Again thank you very much and thanks for the quick response. @@NickJanetakis
Great video! I studying up on Docker Swarm and was wondering if it is possible to run multiple instances of docker on the same machine to simulate a swarm environment. Is it possible to extend what you describe to run the service multiple times?
Hi, thanks. Personally I don't use Swarm but it should work if it works on native Linux. This set up is no different than a straight up legit native Linux environment, so if you wanted to modify your search terms for that, you might be able to find an answer easier.
This is amazing. One follow-up question after I've got it running now. I have a 100Gb SSD C: drive that's like 95% full and an 800 Gb spinning drive that's only like 10% full. How can I store all these images on my spinning drive that still has tons of room on it?? 🙏
Hmm, maybe you could spin up a WSL 2 instance on your HDD and install Docker there? I think if you tried to set a mounted directory just for Docker within an SSD WSL 2 instance you'll get hit pretty hard by disk mount slowness between Windows and WSL 2.
Thanks for your tutorial. Could you tell me more about how to connect to the installed docker from another computer (they are all in the same network). I tried but it seem I can only access my app using "localhost" not the "ip" of the computer I installed wsl
@@GamePlayByFaks Did you add the shell script to your bash profile or equivalent file that's in the video? That's the part that would start Docker. I set this up personally on my box about 2 months ago, these were the only steps I took. Are you using Ubuntu 20.04 or 22.04?
@@GamePlayByFaks I see, Ubuntu 22.04 has some quirks, but I was able to find a working solution which I just tried on a fresh Ubuntu 22.04 WSL 2 install and it worked. Run this: sudo update-alternatives --config iptables Then choose option "1", now the command to start Docker will work. After closing your terminal and opening a new one you'll be able to run `docker info` successfully which verifies you can connect to the server without needing sudo and that it's running. No need to reboot or restart WSL.
If you're not using Docker Desktop then you won't need a license for it. Running Docker in WSL like we do in this video is comparable to running Docker on native Linux without Docker Desktop. Personally I wouldn't use this as a tactic to avoid paying for a license tho, their price is very fair already.
Have you ever run into an issue where once docker starts you can't access the net from your wsl2 instance? For example you can start a ping and let it run, start docker (in a different terminal window) and a few seconds later the ping will stall, nslookup etc will also fail for anything outside of wsl2. It's very annoying, had been working fine for months prior to this happening. I suspect something in an update/upgrade modified or does not like my config. Using win 11/ Ubuntu 22.04 with systemd. It was auto starting but disabled it to troubleshoot the issue.
Every once in a while yes but it seems unrelated to Docker, it's also worth pointing out I'm not using systemd too. If you edit /etc/resolv.conf you can change your nameserver to 8.8.8.8 or 1.1.1.1 to use Google or CloudFlare's DNS and things will start working immediately. The interesting part is right now DNS is working and my nameserver is set to 172.17.112.1 so it's not like I'm always using Google or Cloudflare's DNS, WSL will periodically rewrite this file by default. Something happens with the default WSL nameserver. There is a closed issue about it here: github.com/microsoft/WSL/issues/4285
@@deyeaus I'm not sure then. I'd suggest Googling for terms around WSL, systemd and Docker along with losing network access. I'd try not using systemd to see if that changes anything, I'm not currently using it so there's a difference there.
Hi, Nick! In Docker Desktop we can change preferences to mount specific folders in File Sharing. How can I change this preferences using Docker in WSL?
Hi, in the case of WSL 2 you'll be able to directly mount paths into Docker. Usually (but not always) your files will exist in WSL 2's file system in which case you can reference those paths in your Docker volumes. If you're volume mounting files from files outside of WSL 2, you can access them by default in /mnt/c where "c" is the drive name, this is the out of the box experience with WSL 2. Although it's worth mentioning performance is painfully slow if you mount in paths through /mnt (this is a limitation of WSL 2, not Docker). If files are inside of WSL 2's file system Docker volume mount performance is pretty much as good as native Linux.
There is no configuration. After installing Docker in the way described in this video you'll have both the engine and the client. The client will "just work" like it does on Linux. Running `docker info` verifies the client can connect to the engine.
@@NickJanetakis yes cool, but what if I have a 2nd WSL distro with docker engine running and want to switch context? Then it helps to understand the underlying "just works"...appreciate if you can point me to some docs.
@@rs3800 Each WSL instance is independent in that case. You'd install Docker in both. Technically you can use a remote Docker host and configure your client to use that, if you wanted to do that you can follow the same instructions for using a remote host on native Linux. I never did it for WSL but I guess you'd use your WSL private IP address.
Nice, but all works only with localhost. You can not reach docker ports from a device in your network. For this you have to add port forwarding , when you are not using Docker Desktop. Until now I found no solution for this, to use WSL without Docker Desktop on Customer side.
@@rescenin you can add an port forwarding, that is what you mean. But Windows firewall blocks all forwarded port by default, so you have also add a firewall rule. But every time you restart wsl you get new IP adresses...
Hello. At first thank you for the awesome video. I tried installing docker in WSL a few times. i get the same error as allways now. even with the "sudo update-alternatives --config iptables". The error Output is : failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.7 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. (exit status 3) Do you have an Idea?
@@NickJanetakis strange. i answered allrady but my comment is gone :P then again. i had WSL 1 active. I upgraded to WSL 2 now it is working.Thank you very much.
Thanks for the video. I did all the steps from video and document. But still my docker daemon is not running. I added script in .profile folder also. Any help would be really appreciated. Thanks!
Can't broadcast in Lan network Whenever we run docker container (docker desktop on windows or docker cli on linux) using broadcast IP 0.0.0.0 & bind port, it gets accessible throughout the local network But in this method it does not Do we have a solution to that
Hi, you can try forwarding your process' port within WSL, there's a few solutions (1 liners) posted here: stackoverflow.com/questions/61002681/connecting-to-wsl2-server-via-local-network
Personally I haven't run any Windows based containers. I'm sure there's a way but if that's your primary use case it might be easier with Docker Desktop. If someone else who has experience with this wants to reply, that would be helpful!
Fish users: # docker if grep -q "microsoft" /proc/version >/dev/null 2>&1 if service docker status 2>&1 | grep -q "is not running" wsl.exe --distribution "(WSL_DISTRO_NAME)" --user root \ --exec service docker start >/dev/null 2>&1 end end
@Nick thanks for your prompt response but I did that. Copied your .z profile file and pasted in a newly created bash_profile file. Sadly the script still didn’t work.
@@marvellousadesanya8480 Did you open a fresh terminal? Did you reboot? What didn't work exactly? Did it throw an error, did nothing happen, etc.? Also are you running WSL 1 or WSL 2? This will only work with WSL 2.
@@marvellousadesanya8480 Technically yes. If you're using bash it will execute every time you start a terminal session. If you're not using bash then nothing will happen.
You should show the step by step from the beginning of the process so others could follow along or see what possible errors we might encounter. The whole "install this, install that... great! now it works." it's not very helpful.
@@NickJanetakis there are some known limitations tho, for example, nvidia docker on wsal2 can only support all the GPUs for now, no option to select just one out of two for an specific container
Slow your speech down. It doesn't make you any smarter. No need to impress. Focus on disseminating information at a moderate pace so folks can learn from you. All the best.
not sure I get the ~/.profile step, you're running a windows program (wsl.exe) from inside the wsl instance? should that really work? in mine it just says "wsl.exe: command not found" (I confirmed that I'm running WSL2)
It should work yeah, we are calling wsl.exe from within WSL 2. You can try it from the command line with other commands too. For example running `explorer.exe .` should open the Windows explorer at the current directory within WSL 2.
@@Thiago-p5q6l localhost should also work out of the box. For example if you run your app on port 8000 and publish that port with Docker then going to localhost:8000 in your host's browser should work.
Hello Nick J, I am following your video and I cannot get service docker status to work. i am getting the following error when i type service docker status service docker status docker: unrecognized service also when i type 'docker run hello-world' docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. some stats Windows 11 Home i am running wsl2 this is what I get when i type the below in the command prompt admin: wsl -l -v NAME STATE VERSION * Ubuntu Running 2 docker --version Docker version 20.10.21, build 20.10.21-0ubuntu1~22.04.3 docker compose version Docker Compose version v2.19.1 i have also done this part sudo update-alternatives --config iptables 0 /usr/sbin/iptables-nft 20 auto mode * 1 /usr/sbin/iptables-legacy 10 manual mode 2 /usr/sbin/iptables-nft 20 manual mode and my ~/.bashrc file has added this (github.com/nickjj/dotfiles/commit/badd3265e5c8f6eca90d3b57df29292545332500) furthermore i can type docker in ubuntu and I can see all the docker commands available please help :)
sorry for overloading your comment section. this is what I get when I type docker info docker info Client: Context: default Debug Mode: false Plugins: compose: Docker Compose (Docker Inc., v2.19.1) Server: ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? errors pretty printing info
Hi I followed the exact steps in your guide. Bud I am getting below error on docker compose up in my Ubuntu-20.04 WLS distro. Any help will be appriciated user@MACHINE:~/src$ docker compose up -d runtime: g1: frame.sp=0xc00059efd0 top=0xc00059ffe0 stack=[0xc000580000-0xc0005a0000] n=6 max=2147483647 fatal error: traceback did not unwind completely runtime stack: fatal error: unexpected signal during runtime execution panic during panic [signal SIGBUS: bus error code=0x2 addr=0x255cda8 pc=0x4037ee] runtime stack: fatal error: unexpected signal during runtime execution stack trace unavailable
Hi, Are you running WSL or WSL 2? Did you uninstall Docker Desktop and reboot? Did you install Docker using the steps in this video or something else? What version of Docker do you have? Did you try Googling for those errors? A quick Googling suggests this is maybe from installing a very very old version of Docker github.com/docker/for-linux/issues/285 which wouldn't be the case if you installed Docker using the steps in this video (these steps will give you the latest stable release of Docker). I ran this set up on Ubuntu 20.04 for a while and lots of others too without issues.
If you're using Ubuntu 22.04 or Debian 10 / 11 you'll need to make 1 small change from the video. You'll need to run `sudo update-alternatives --config iptables` and choose option (1) from the prompt to install the legacy version of iptables. Once that's installed everything else works 100% the same and Docker will start successfully.
Thanks for this great video! I just got it all working now after running this command.
Holy crap slowing this video down to .75x makes the dialog seem pretty much normal speed.
Thank you so much! I was struggling with Docker Desktop. This solution worked wonders!
super clear and you addressed all doubts. came here cuz apparently docker-desktop is causing vmmem to max out memory usage. thanks!
Thanks for watching and no problem!
Did it reduce the RAM usage? I am having the same problem
@@shashanksingh4708did it? thinking of setting up a second drive with windows, would be interesting to know.
@@TVPInterpolation I didn't go ahead with the implementation.....
@@shashanksingh4708 too bad, but thanks for responding!
Thanks for taking the time to explain the ins and outs of this. I did not even know we had a choice. I just re-installed my 3 year old 9570 and chose to stay away from DDesktop. Volumes really seem faster.
One small thing I will miss is the neat log/terminal pane in the DDesktop container GUI. But Docker Desktop feels like a nuclear powerplant in terms of footprint and I can probably easily add some aliases to my .bashrc to the same effect.
On a side note: you mention that your workstation has 16G of RAM. I do not know the type of workflows that you're running, but I have a 32G and 64G machine and the 32G machine sometimes runs a bit short on memory (WSL2 eats memory like pandas on a bamboo gobbling spree) .
Hi, WSL 2 has issues around not releasing memory and disk space. A few years ago I made a video on how to clear your memory and disk space at: th-cam.com/video/4PwClrUCqJM/w-d-xo.html, it still applies today. With Docker running directly in the WSL 2 instance you'll want to follow the disk space steps from time to time too.
@@NickJanetakis Precious advice! Thanks a lot, Nick.
Very helpful, thanks mate! I've been struggling to get docker to work without docker-desktop on linux
Thanks for the video! I will definitely install docker derectly into WSL2, because I have never used GUI, k8s feature
Thanks much dood. it's working perfectly.
Hey Nick, thanks for the tutorial! systemd support in now available on WSL.
No problem. It does support systemd but it's very unstable, or at least it was a few months ago. If you close your terminal the process would crash or stop after a pretty short amount of time, meaning you'd have to wait for Docker to spin up again when you close your terminal. The method used in this video doesn't have that problem. It stays up until you reboot your machine or kill the whole WSL process.
the lungs pf this man are the strongest of the world, ty for the video
Thanks for watching haha.
great video. thank, you. Not sure if i accidently hit the 1.5x speed button or you ingested 1.5 buttons of speed.
No problem, thanks for watching. I may have ingested buttons of speed.
Hi Nick, great vid! is there still a way to avoid using WSL and docker desktop ? aren't there any installers meant to be install docker on windows without WSL ?
Thanks. I think you can still use the Hyper-V backed Docker Desktop if you wanted to avoid WSL 2 but WSL 2 nowadays is just a Windows app that you can optionally install. If you want to avoid all of that you can manage your own custom Linux based VM.
Hi, great video. It worked fine for me. One extra thing, will there be any way to run docker, with all the previous configuration, but without entering the WSL console? It is that my project is in the windows folders, and the idea is to run docker from the terminal from where the docker-compose document is hosted. Thanks a lot.
Thanks. In this case Docker is installed and running in WSL. You can access Windows files from within WSL. By default your drives will be mounted in the /mnt folder, so you can run something like `cd /mnt/c` if you have a C:\ drive on Windows. Although the volume mount performance using this method will be very slow compared to having files directly in WSL. By the way you can access WSL files in Windows too. You can open a Windows explorer window and goto `\\wsl.localhost\Ubuntu` , assuming you're running Ubuntu in WSL.
I was hoping in my head that it could be run transparently as in docker-desktop, but I'll settle for that information. Again thank you very much and thanks for the quick response. @@NickJanetakis
Great video! I studying up on Docker Swarm and was wondering if it is possible to run multiple instances of docker on the same machine to simulate a swarm environment. Is it possible to extend what you describe to run the service multiple times?
Hi, thanks. Personally I don't use Swarm but it should work if it works on native Linux. This set up is no different than a straight up legit native Linux environment, so if you wanted to modify your search terms for that, you might be able to find an answer easier.
That helped a lot. Thanks for sharing.
This is amazing. One follow-up question after I've got it running now.
I have a 100Gb SSD C: drive that's like 95% full and an 800 Gb spinning drive that's only like 10% full. How can I store all these images on my spinning drive that still has tons of room on it?? 🙏
Hmm, maybe you could spin up a WSL 2 instance on your HDD and install Docker there? I think if you tried to set a mounted directory just for Docker within an SSD WSL 2 instance you'll get hit pretty hard by disk mount slowness between Windows and WSL 2.
Thank you, working!
Thanks, that works for me!
Man that's really cool, thanks
Thanks for your tutorial. Could you tell me more about how to connect to the installed docker from another computer (they are all in the same network). I tried but it seem I can only access my app using "localhost" not the "ip" of the computer I installed wsl
Hi, try superuser.com/a/1717756 since this is separate from Docker. Replace the port with whatever port you're trying to access.
Ironic, recently tried and failed to start it in wsl 2, seems stars are alinged since got your video, you got same idea as me.
hmm, odd did fresh install on wsl of Ubuntu and did all and it doesn't start, maybe you missed something out ?
@@GamePlayByFaks Did you add the shell script to your bash profile or equivalent file that's in the video? That's the part that would start Docker. I set this up personally on my box about 2 months ago, these were the only steps I took. Are you using Ubuntu 20.04 or 22.04?
@@NickJanetakis 22.04 and did added on bash, and that was odd.
@@GamePlayByFaks I see, Ubuntu 22.04 has some quirks, but I was able to find a working solution which I just tried on a fresh Ubuntu 22.04 WSL 2 install and it worked.
Run this:
sudo update-alternatives --config iptables
Then choose option "1", now the command to start Docker will work.
After closing your terminal and opening a new one you'll be able to run `docker info` successfully which verifies you can connect to the server without needing sudo and that it's running. No need to reboot or restart WSL.
Thanks a lot for calling this out btw, I pinned a comment for Ubuntu 22.04 support and updated my blog post to mention this step.
Is the docker on wsl free to use if i am working in a company that doesnt fit in free usage policy for docker desktop
If you're not using Docker Desktop then you won't need a license for it. Running Docker in WSL like we do in this video is comparable to running Docker on native Linux without Docker Desktop. Personally I wouldn't use this as a tactic to avoid paying for a license tho, their price is very fair already.
Have you ever run into an issue where once docker starts you can't access the net from your wsl2 instance? For example you can start a ping and let it run, start docker (in a different terminal window) and a few seconds later the ping will stall, nslookup etc will also fail for anything outside of wsl2. It's very annoying, had been working fine for months prior to this happening. I suspect something in an update/upgrade modified or does not like my config. Using win 11/ Ubuntu 22.04 with systemd. It was auto starting but disabled it to troubleshoot the issue.
Every once in a while yes but it seems unrelated to Docker, it's also worth pointing out I'm not using systemd too. If you edit /etc/resolv.conf you can change your nameserver to 8.8.8.8 or 1.1.1.1 to use Google or CloudFlare's DNS and things will start working immediately. The interesting part is right now DNS is working and my nameserver is set to 172.17.112.1 so it's not like I'm always using Google or Cloudflare's DNS, WSL will periodically rewrite this file by default. Something happens with the default WSL nameserver. There is a closed issue about it here: github.com/microsoft/WSL/issues/4285
@@NickJanetakis I've already tried that, it made no difference unfortunately. Even specifying different DNS when using nslookup failed.
@@deyeaus I'm not sure then. I'd suggest Googling for terms around WSL, systemd and Docker along with losing network access. I'd try not using systemd to see if that changes anything, I'm not currently using it so there's a difference there.
Hi, Nick! In Docker Desktop we can change preferences to mount specific folders in File Sharing. How can I change this preferences using Docker in WSL?
Hi, in the case of WSL 2 you'll be able to directly mount paths into Docker. Usually (but not always) your files will exist in WSL 2's file system in which case you can reference those paths in your Docker volumes. If you're volume mounting files from files outside of WSL 2, you can access them by default in /mnt/c where "c" is the drive name, this is the out of the box experience with WSL 2. Although it's worth mentioning performance is painfully slow if you mount in paths through /mnt (this is a limitation of WSL 2, not Docker). If files are inside of WSL 2's file system Docker volume mount performance is pretty much as good as native Linux.
@@NickJanetakis Thank you!!
Thanks for the video men, is very usefull
I think I missed the part where the *docker client* is configured to use the newly installed docker engine in WSL?
There is no configuration. After installing Docker in the way described in this video you'll have both the engine and the client. The client will "just work" like it does on Linux.
Running `docker info` verifies the client can connect to the engine.
@@NickJanetakis yes cool, but what if I have a 2nd WSL distro with docker engine running and want to switch context? Then it helps to understand the underlying "just works"...appreciate if you can point me to some docs.
@@rs3800 Each WSL instance is independent in that case. You'd install Docker in both. Technically you can use a remote Docker host and configure your client to use that, if you wanted to do that you can follow the same instructions for using a remote host on native Linux. I never did it for WSL but I guess you'd use your WSL private IP address.
Nice, but all works only with localhost. You can not reach docker ports from a device in your network. For this you have to add port forwarding , when you are not using Docker Desktop. Until now I found no solution for this, to use WSL without Docker Desktop on Customer side.
you can try manually add ip route
@@rescenin you can add an port forwarding, that is what you mean. But Windows firewall blocks all forwarded port by default, so you have also add a firewall rule. But every time you restart wsl you get new IP adresses...
@@matthiasstehr2266 yeah, it changes everytime... Is there a way to fix ip? So it won't change everytime.
yeah I gave up, so much trouble to make it work.
Hello. At first thank you for the awesome video. I tried installing docker in WSL a few times. i get the same error as allways now. even with the "sudo update-alternatives --config iptables".
The error Output is :
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.7 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
(exit status 3)
Do you have an Idea?
Hey, which WSL 2 distro and version are you using?
@@NickJanetakis strange. i answered allrady but my comment is gone :P then again. i had WSL 1 active. I upgraded to WSL 2 now it is working.Thank you very much.
@@michelschuler6132 Oh nice, glad to hear it's all working.
Thanks for the video.
I did all the steps from video and document. But still my docker daemon is not running. I added script in .profile folder also.
Any help would be really appreciated.
Thanks!
Are you using WSL 2?
Can't broadcast in Lan network
Whenever we run docker container (docker desktop on windows or docker cli on linux) using broadcast IP 0.0.0.0 & bind port, it gets accessible throughout the local network
But in this method it does not
Do we have a solution to that
Hi, you can try forwarding your process' port within WSL, there's a few solutions (1 liners) posted here: stackoverflow.com/questions/61002681/connecting-to-wsl2-server-via-local-network
Can windows docker image run on the linux environment? How to run it then?
Personally I haven't run any Windows based containers. I'm sure there's a way but if that's your primary use case it might be easier with Docker Desktop. If someone else who has experience with this wants to reply, that would be helpful!
Thank you but where is my docker images? I can't find them.
Hi, everything Docker related is in /var/lib/docker. You can cd into that directory and check things out. You'll need to be the root user.
@@NickJanetakis thank you Nick. Also do we need to map ip from ifnet like you did everytime we reboot the system?
@@capocianni1043 I never had to map an IP address.
@@NickJanetakis Okay, thank you for replies.
Fish users:
# docker
if grep -q "microsoft" /proc/version >/dev/null 2>&1
if service docker status 2>&1 | grep -q "is not running"
wsl.exe --distribution "(WSL_DISTRO_NAME)" --user root \
--exec service docker start >/dev/null 2>&1
end
end
Thanks for adding that!
Got stuck. Can’t find a bash_profile file… or z profile
What about a ~/.bashrc file? You can also create the ~/.bash_profile file if it doesn't exist.
@Nick thanks for your prompt response but I did that. Copied your .z profile file and pasted in a newly created bash_profile file. Sadly the script still didn’t work.
You mean I can also add the script to the .bashrc file?
@@marvellousadesanya8480 Did you open a fresh terminal? Did you reboot? What didn't work exactly? Did it throw an error, did nothing happen, etc.?
Also are you running WSL 1 or WSL 2? This will only work with WSL 2.
@@marvellousadesanya8480 Technically yes. If you're using bash it will execute every time you start a terminal session. If you're not using bash then nothing will happen.
You should show the step by step from the beginning of the process so others could follow along or see what possible errors we might encounter. The whole "install this, install that... great! now it works." it's not very helpful.
Hi, which steps weren't covered besides installing WSL 2 itself? Did you encounter any errors? Which error did you get?
I'll try this with nvidia docker, if it works, this would me just amazing.
Let us know how it goes.
@@NickJanetakis It went smoothly, Nvidia supports now windows drivers inside WSL2 directly, so no patch of any kind needed to run it
@@NickJanetakis there are some known limitations tho, for example, nvidia docker on wsal2 can only support all the GPUs for now, no option to select just one out of two for an specific container
Slow your speech down. It doesn't make you any smarter. No need to impress. Focus on disseminating information at a moderate pace so folks can learn from you. All the best.
Bruh! You ain't lying. He needs to chill!
nice.
On thing tho; bro, you talk too damn fast. x)
not sure I get the ~/.profile step, you're running a windows program (wsl.exe) from inside the wsl instance? should that really work? in mine it just says "wsl.exe: command not found" (I confirmed that I'm running WSL2)
It should work yeah, we are calling wsl.exe from within WSL 2. You can try it from the command line with other commands too. For example running `explorer.exe .` should open the Windows explorer at the current directory within WSL 2.
Ah, it was me all along, i had set appendWindowsPath=false 😅 now all that's left is for the localhost to work from the windows host
@@Thiago-p5q6l localhost should also work out of the box. For example if you run your app on port 8000 and publish that port with Docker then going to localhost:8000 in your host's browser should work.
Hello Nick J, I am following your video and I cannot get service docker status to work.
i am getting the following error when i type service docker status
service docker status
docker: unrecognized service
also when i type 'docker run hello-world'
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
some stats
Windows 11 Home
i am running wsl2
this is what I get when i type the below in the command prompt admin:
wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
docker --version
Docker version 20.10.21, build 20.10.21-0ubuntu1~22.04.3
docker compose version
Docker Compose version v2.19.1
i have also done this part
sudo update-alternatives --config iptables
0 /usr/sbin/iptables-nft 20 auto mode
* 1 /usr/sbin/iptables-legacy 10 manual mode
2 /usr/sbin/iptables-nft 20 manual mode
and my ~/.bashrc file has added this (github.com/nickjj/dotfiles/commit/badd3265e5c8f6eca90d3b57df29292545332500)
furthermore i can type docker in ubuntu and I can see all the docker commands available
please help :)
sorry for overloading your comment section.
this is what I get when I type docker info
docker info
Client:
Context: default
Debug Mode: false
Plugins:
compose: Docker Compose (Docker Inc., v2.19.1)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
@@jesseb604 hey, did you start the docker service? You can add Nick's shell script (at 11:19) to your .bash_profile and restart wsl.
Thanks for replying. That's what I would suggest too.
Hi I followed the exact steps in your guide. Bud I am getting below error on docker compose up in my Ubuntu-20.04 WLS distro. Any help will be appriciated
user@MACHINE:~/src$ docker compose up -d
runtime: g1: frame.sp=0xc00059efd0 top=0xc00059ffe0
stack=[0xc000580000-0xc0005a0000] n=6 max=2147483647
fatal error: traceback did not unwind completely
runtime stack:
fatal error: unexpected signal during runtime execution
panic during panic
[signal SIGBUS: bus error code=0x2 addr=0x255cda8 pc=0x4037ee]
runtime stack:
fatal error: unexpected signal during runtime execution
stack trace unavailable
Hi,
Are you running WSL or WSL 2? Did you uninstall Docker Desktop and reboot? Did you install Docker using the steps in this video or something else? What version of Docker do you have? Did you try Googling for those errors? A quick Googling suggests this is maybe from installing a very very old version of Docker github.com/docker/for-linux/issues/285 which wouldn't be the case if you installed Docker using the steps in this video (these steps will give you the latest stable release of Docker). I ran this set up on Ubuntu 20.04 for a while and lots of others too without issues.
@@NickJanetakis Thank you Nick I did not rebooted my system. After rebooting it worked