Systemd Enabled Service: Docker Start Doesn't Work
This article focuses on the issue of enabling the systemd service in the /etc/wsl.conf file, but Docker starts with an error. The article will cover the key concepts related to this problem and provide detailed context and solutions.
Introduction
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019. WSL enables users to run a Linux distribution alongside their existing Windows applications without the need for a traditional virtual machine or dual-boot setup.
The Problem
When enabling the systemd service in the /etc/wsl.conf file, Docker fails to start. The error message is:
$ sudo service docker start
Failed to start docker.service: The name org.freedesktop.PolicyKit1 was not provided by any .service filesCause
The cause of this issue is that the systemd service is not properly configured in WSL. This can be due to several reasons, including:
- Incorrect configuration of the
/etc/wsl.conffile - Missing dependencies for the
systemdservice - Conflicts with other services or applications
Solution
To solve this issue, follow these steps:
- Check the
/etc/wsl.conffile to ensure that thesystemdservice is enabled:
$ cat /etc/wsl.conf
[boot]
systemd=true- If the
systemdservice is enabled, try restarting WSL:
$ wsl --shutdown
$ wsl- If Docker still fails to start, try reinstalling Docker.
Enabling the systemd service in WSL can cause issues with Docker. However, by following the steps outlined in this article, users can resolve the issue and ensure that both systemd and Docker are properly configured in WSL.
References
Note: This article is not intended to be a comprehensive guide to WSL or Docker. It is provided as-is and is not guaranteed to be accurate or up-to-date. The author is not responsible for any damages or losses incurred as a result of using this information.