I've tried to run Docker on WSL unsuccessfully. I've installed Docker on WSL following the steps given to install Docker on Ubuntu but when I execute docker ps
I get the following error:
docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Watching docker logs I found this:
level=warning msg="Running modprobe nf_nat failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-43-Microsoft/modules.dep.bin'\nmodprobe: WARNING: Module nf_nat not found in directory /lib/modules/4.4.0-43-Microsoft`, error: exit status 1" time="2017-12-28T12:07:23.227671600+01:00" level=warning msg="Running modprobe xt_conntrack failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-43-Microsoft/modules.dep.bin'\nmodprobe: WARNING: Module xt_conntrack not found in directory /lib/modules/4.4.0-43-Microsoft`, error: exit status 1" Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: iptables failed: iptables -t nat -N DOCKER: iptables v1.6.0: 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)
Any idea how can I run Docker on WSL?
We recommend using Docker Desktop due to it's integration with Windows and Windows Subsystem for Linux. However, while Docker Desktop supports running both Linux and Windows containers, you can not run both simultaneously.
The Docker engine is free. So the license update won't be any problem for your development and production environment. Portainer is a production-ready software to manage your Docker environment that also often is used in a server cluster environment.
Overview. It is now possible to run Docker containers on Windows 10 and Windows Server, leveraging Ubuntu as a hosting base. Imagine running your own Linux applications on Windows, using a Linux distribution you are comfortable with: Ubuntu!
Docker Desktop is Docker (the company)'s first wedge into getting you to run proprietary software, so Docker strongly guides you to download it as the only way to get started: In fact, new users can go pretty far without even realizing that you don't need Docker Desktop to run the Docker daemon.
Finally, I could run Docker on WSL in an easy way: You need first to install and run Docker Engine on Windows and then just create a symbolic link on Ubuntu bash pointing to the Windows executable:
sudo ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker.exe /usr/bin/docker
This link works because from version Windows 10 Creators Update it's possible to run Windows executables from Bash. If your Windows version is previous to Windows 10 Creators Update you can try the solution explained in this blog
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With