TipsAndTricks/DockerOnImage: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
Line 43: Line 43:
  PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
  PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
  PREFERRED_VERSION_linux-yocto="4.9%"
  PREFERRED_VERSION_linux-yocto="4.9%"


  # add docker to the image                                                                                                                                 
  # add docker to the image                                                                                                                                 

Revision as of 18:21, 7 July 2017

This assumes you'd like to build an image that supports docker on a YP image. This is pretty straightforward due to the great work done on the meta-virtualization layer, mostly by people at Wind River. This document will show how to get docker running on a Minnowboard (Turbot). Note, these layers change, so this is accurate as of July 2017.

What Layers Do You Need?

The main layer is meta-virtualization. This can be found using the layers.openembedded search app, Here's the [meta-virtualiation] entry. As you can see from the dependency list, this layer requires oe-core,meta-oe, meta-networking, and meta-filesystems. Some of these (like meta-networking) have additional dependencies. Here's the complete list of additional layers you need:

You need to add these (with absolute paths) to your build/conf/bblayers.conf file. BBLAYERS should look something like this:

BBLAYERS ?= " \                                                                                                                                          
 <AbsPath>/poky/meta \                                                                                                                                  
 <AbsPath>/poky/meta-poky \                                                                                                                             
 <AbsPath>/poky/meta-yocto-bsp \                                                                                                                        
 <AbsPath>/meta-openembedded/meta-oe \                                                                                                                  
 <AbsPath>/meta-openembedded/meta-python \                                                                                                              
 <AbsPath>/meta-openembedded/meta-networking \                                                                                                          
 <AbsPath>/meta-openembedded/meta-filesystems \                                                                                                         
 <AbsPath>/meta-virtualization \                        

What Configuration Changes Do you Need?

There are a number of configuration settings you need in your build/conf/local.conf in order to make this work. I'll list them below and try to explain why you need them:

# this gives us the linux-yocto kernel for an x86-64 machine like minnowboard                                                                            
MACHINE = "genericx86-64"
# Docker presumes systemd                                                                                                                                 
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
# we need space for images                                                                                                                               
IMAGE_ROOTFS_EXTRA_SPACE = "10000000"
# The extra space takes us above 4gb, so                                                                                                                 
# turn off hdd and iso images so they do                                                                                                                 
# not break                                                                                                                                              
NOHDD="1"
NOISO="1"
# pick a kernel I know works:                                                                                                                            
PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
PREFERRED_VERSION_linux-yocto="4.9%"
# add docker to the image                                                                                                                                
# connman to manage the networking                                                                                                                       
IMAGE_INSTALL_append = "  docker docker-contrib connman connman-client \                                                                                 
"