Bug 11845

Summary: Docker daemon does not start on boot, error in Docker init script
Product: [Yocto Project Subprojects] Layer Index Reporter: Alexandru Tiniuc <tiniuclx>
Component: Layer IndexAssignee: Paul Eggleton <bluelightning>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Undecided CC: brian.avery, bruce.ashfield
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alexandru Tiniuc 2017-07-27 13:46:00 UTC
Preconditions/Environment
-------------------------
I am working on a custom Raspberry Pi image, it inherits rpi-hwup-image inside the Raspberry Pi BSP. The only change is the addition of docker to IMAGE_INSTALL. As far as I am aware, I am using the latest commits inside the master branches of all layers and dependencies.

Triggering Action/Cause
-----------------------
Booting the image generated by the recipe described above.

Expectation
-----------
Docker Daemon starts, you are able to download, compile and run containers without any other configuration.

Actual Result
-------------
Docker Daemon does not start. Inspection of /var/log/docker.log reveals the following (paraphrased): "The 'docker daemon' command is unavailable on Linux. Use 'dockerd' instead."

Reproducibility
---------------
I flashed an SD card with the image ~10 times while trying to figure out why the daemon wouldn't start. It failed every time until I came up with an apparently working fix.

My Proposed Fix:
----------------
Modify the following file:
meta-virtualization/recipes-containers/docker/files/docker.init

1. Make the value of the prog variable "dockerd" instead of "docker"

2. Inside the start() function definition, change " "$unshare" -m -- $exec daemon ..." to " "$unshare" -m -- $exec " (the word daemon is removed)

Here is a pastebin of git diff showing the aforementioned changes: https://pastebin.com/hkEuz0zX
Comment 1 Paul Eggleton 2017-08-01 09:43:31 UTC
The docker recipe is in meta-virtualization, and I'm afraid that we don't track bugs in meta-virtualization in the Yocto Project bugzilla (the layer index category is for bugs in the layer index itself, not any particular layer tracked within it). Since you have a proposed change, assuming it is applicable to current meta-virtualization I would recommend submitting a patch for it - see here for details on how you should do that:

http://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization/tree/README
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

(I have also added Bruce Ashfield, the main maintainer of meta-virtualization, on CC for this bug but it may still get lost in the noise.)
Comment 2 Bruce Ashfield 2017-08-04 03:04:00 UTC
Thanks Paul!

I did see this message and will look for discussion on the meta-virtualization list.

I'm building and running docker as a default start service on my images every day, so it does work in the master branch. We'd have to look at (and test) any patches in that context.