Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service docker start doesn't work if systemd is enabled #12307

Open
1 of 2 tasks
prescriptionlifeline opened this issue Nov 21, 2024 · 7 comments
Open
1 of 2 tasks

service docker start doesn't work if systemd is enabled #12307

prescriptionlifeline opened this issue Nov 21, 2024 · 7 comments

Comments

@prescriptionlifeline
Copy link

Windows Version

Microsoft Windows [Version 10.0.26100.2314]

WSL Version

2.3.26.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.15.167.4-microsoft-standard-WSL2 (root@f9c826d3017f) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Tue Nov 5 00:21:55 UTC 2024

Distro Version

Ubuntu 22.04.3 LTS

Other Software

docker --version (in WSL / Ubuntu) returns this:

Docker version 25.0.3, build 4debf41

wsl --version (in Windows) returns this:

WSL version: 2.3.26.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.2314

Repro Steps

service docker start

Expected Behavior

I'd expect service docker start to run without error.

Actual Behavior

service docker start gives this error:

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.

Diagnostic Logs

Here's the output of systemctl status docker.service:

× docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2024-11-21 04:35:46 CST; 4min 35s ago
TriggeredBy: × docker.socket
       Docs: https://docs.docker.com
    Process: 1922 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
   Main PID: 1922 (code=exited, status=1/FAILURE)

Nov 21 04:35:46 DESKTOP-OF86R9V systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Nov 21 04:35:46 DESKTOP-OF86R9V systemd[1]: Stopped Docker Application Container Engine.
Nov 21 04:35:46 DESKTOP-OF86R9V systemd[1]: docker.service: Start request repeated too quickly.
Nov 21 04:35:46 DESKTOP-OF86R9V systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 21 04:35:46 DESKTOP-OF86R9V systemd[1]: Failed to start Docker Application Container Engine.

Here's the output of journalctl -xeu docker.service:

https://pastebin.com/5u5vWS87

If I have this in my /etc/wsl.conf file service docker start doesn't work:

[boot]
systemd=true

If I comment out the systemd=true bit service docker start works but not with that line in place.

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@zcobol
Copy link

zcobol commented Nov 21, 2024

@prescriptionlifeline docker.service does work under systemd!

Here's sample output on WSL Ubuntu 24.04:

zcobol@miami:~$ systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-11-21 07:39:15 PST; 8s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 353 (dockerd)
      Tasks: 12
     Memory: 107.0M ()
     CGroup: /system.slice/docker.service
             └─353 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.708219050-08:00" level=info msg="Default bridge (docker0>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.796400334-08:00" level=info msg="Loading containers: don>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.814302060-08:00" level=warning msg="WARNING: No blkio th>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.814338568-08:00" level=warning msg="WARNING: No blkio th>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.814346714-08:00" level=warning msg="WARNING: No blkio th>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.814351933-08:00" level=warning msg="WARNING: No blkio th>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.814368675-08:00" level=info msg="Docker daemon" commit=4>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.814666644-08:00" level=info msg="Daemon has completed in>
Nov 21 07:39:15 RIPPER dockerd[353]: time="2024-11-21T07:39:15.872367668-08:00" level=info msg="API listen on /run/dock>
Nov 21 07:39:15 RIPPER systemd[1]: Started docker.service - Docker Application Container Engine.
zcobol@miami:~$ wslinfo --wsl-version
2.4.4

@prescriptionlifeline
Copy link
Author

In my case I was using Ubuntu 22.04 - not Ubuntu 24.04.

I'll try it under Ubuntu 24.04 when I'm back in the office.

Per the wsl --version output I posted you're also running a newer version of WSL than I am (I'm running 2.3.26 vs your 2.4.4 install). That might could make a difference as well.

@sirredbeard
Copy link
Contributor

@prescriptionlifeline Are you using docker-ce from the Ubuntu package repository or installing using the Docker apt repository? I would suggest installing from the Docker apt repository.

@prescriptionlifeline
Copy link
Author

@sirredbeard - I installed Docker thusly (I have a private wiki entry with instructions on how to setup my WSL install to my liking, hence my having the steps I used readily available):

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install docker-ce docker-ce-cli containerd.io

@sirredbeard
Copy link
Contributor

Okay, that rules out issues with the distro-based package.

I took a look back at your log files and noted this:

failed to start daemon, ensure docker is not running or delete /var/run/docker.pid: process with PID 23 is still running

It seems like Docker is still running.

Do you have Docker Desktop installed?

Do you have another distro with Docker running?

Is it possible you have Docker installed twice, like from the distro package repo and from the Docker apt repo?

@prescriptionlifeline
Copy link
Author

The answer to all your questions is no.

That said I did some further testing. The problem only occurs if both command=service docker start and systemd=true are both present in the [boot] section of my /etc/wsl.conf file. eg.

[boot]
command=service docker start
systemd=true

...or:

[boot]
systemd=true
command=service docker start

If my wsl.conf file just has this it works just fine:

[boot]
systemd=true

Like I can do sudo service docker start multiple times and it works without issue.

Likewise if my wsl.conf file just has this in it it works just fine:

[boot]
command=service docker start

Like I can do sudo service docker start multiple times and it works without issue. Interestingly, whereas if I just have systemd=true and that's it sudo service docker start doesn't output anything but if I have just command=service docker start the output of that command is this:

 * Starting Docker: docker

So why would the two options work in isolation but not together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants