title: "sudo systemctl enable docker" not available: Automatically run Docker at boot on WSL2 (using a "sysvinit" / "init" command or a workaround)
body: <p>I am using Ubuntu on WSL2 (not on Docker Desktop).</p>
  <p>According to <a href="https://techoverflow.net/2018/12/15/how-to-fix-docker-cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-the-docker-daemon-running-on-ubuntu/" rel="noreferrer">How to fix docker ‘Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?’ on Ubuntu</a>, I can automatically start the docker daemon at boot using</p>
  <pre><code>sudo systemctl enable docker
  </code></pre>
  <p>instead of just starting it again at every boot with</p>
  <pre><code>sudo systemctl start docker
  </code></pre>
  <p>with both commands avoiding &quot;Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?&quot;.</p>
  <p>When using any of the two, I get</p>
  <blockquote>
  <p>Synchronizing state of docker.service with SysV service script with
  /lib/systemd/systemd-sysv-install. Executing:
  /lib/systemd/systemd-sysv-install enable docker</p>
  </blockquote>
  <p>and a test run shows, that docker is not yet running:</p>
  <blockquote>
  <pre><code>docker run hello-world 
  </code></pre>
  <p>docker: Cannot connect to the Docker daemon at
  unix:///var/run/docker.sock. Is the docker daemon running?. See
  'docker run --help'.</p>
  </blockquote>
  <p>Some steps before, I also got a different message at this point:</p>
  <blockquote>
  <p>System has not been booted with systemd as init system (PID 1). Can't
  operate.Failed to connect to bus: Host is down&quot;</p>
  </blockquote>
  <p>which brought me to <a href="https://linuxhandbook.com/system-has-not-been-booted-with-systemd/" rel="noreferrer">Fixing &quot;System has not been booted with systemd as init system&quot; Error</a>:</p>
  <blockquote>
  <p>Reason: Your Linux system is not using systemd
  How to know which init system you are using? You may use this command
  to know the process name associated with PID 1 (the first process that
  runs on your system):</p>
  <pre><code>ps -p 1 -o comm=
  </code></pre>
  <p>It should show systemd or sysv (or something like that) in the output.</p>
  </blockquote>
  <p><code>ps -p 1 -o comm=</code> gave me <code>init</code>.</p>
  <p>According to this and this table</p>
  <p><a href="https://i.stack.imgur.com/A0qyP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/A0qyP.png" alt="enter image description here" /></a></p>
  <pre><code>Systemd command
      Sysvinit command
  
  systemctl start service_name
      service service_name start
  
  systemctl stop service_name
      service service_name stop
  
  systemctl restart service_name
      service service_name restart
  
  systemctl status service_name
      service service_name status
  
  systemctl enable service_name
      chkconfig service_name on
  
  systemctl disable service_name
      chkconfig service_name off
  </code></pre>
  <p>I can choose <code>service docker start</code> to run docker, which works. But I cannot find something like &quot;systemd&quot;'s <code>sudo systemctl enable docker</code> for &quot;sysvinit&quot;. I would expect it to be like:</p>
  <pre><code>sudo service docker enable
  </code></pre>
  <p>But that &quot;enable&quot; is not available for &quot;sysvinit&quot; / &quot;init&quot;.</p>
  <p>While <code>sudo service docker start</code> works like <code>sudo systemctl start docker</code>, there is no such command that uses &quot;enable&quot;. At the moment, I need to run <code>sudo service docker start</code> whenever I start WSL2.</p>
  <p>The question:</p>
  <p><strong>What is the command that reaches <code>sudo systemctl enable docker</code> using <code>sudo service docker ...</code>, or if that does not exist, what is a workaround here to automatically start docker when opening Ubuntu on WSL2?</strong></p>