DEV Community

jgngo
jgngo

Posted on

8 3

Install Docker Community in WSL 2 (Ubuntu 22.04)

After installing Ubuntu 22.04 stable in WSL, I proceeded to install Docker Engine using the official Docker instructions. Since this is WSL, running sudo systemctl start docker does not work. To start the docker service, you'll need to use sudo /etc/init.d/docker start.

You will notice that the docker service is not running if you check using sudo /etc/init.d/docker status. The reason is because of this error in starting docker.

To fix this, you will need to update your default iptables to the legacy option. After doing this, you should be able to start the docker service and run the normal docker commands.

$ sudo update-alternatives --config iptables

There are 2 choices for the alternative iptables (providing /usr/sbin/iptables).

  Selection    Path                       Priority   Status
------------------------------------------------------------
* 0            /usr/sbin/iptables-nft      20        auto mode
  1            /usr/sbin/iptables-legacy   10        manual mode
  2            /usr/sbin/iptables-nft      20        manual mode
Enter fullscreen mode Exit fullscreen mode

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay