# How to generate a yocto image with docker engine?

**URL:** <https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800>\
**Category:** General Discussions\
**Created:** [April 16, 2020, 4:32pm UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800 "2020-04-16T16:32:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jchdel](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/jchdel/32/681_2.png) [@jchdel](https://hub.mender.io/u/jchdel)\
**Post date:** [April 16, 2020, 4:32pm UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/1 "2020-04-16T16:32:25Z")

</div>

Hi,  
I’m trying to run a mender image build with yocto that will run docker containers.

I do not find in the doc how to achieve this and using docker-artifact-gen then uploading the mender artifact and deploying it leads to errors in logs because docker engine is not present.  
I suppose it is a matter of adding the right meta-layer to the build but how can I find which one and where to point sources to?

thanks!  
Jean-Charles

---

<div class="post-metadata">

**Author:** ![eystein](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@eystein](https://hub.mender.io/u/eystein)\
**Post date:** [April 16, 2020, 8:27pm UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/2 "2020-04-16T20:27:11Z")

</div>

Hi @jchdel!

Many people find Yocto a bit challening in the beginning.

So even though this is not strictly related to Mender, we do have a forum category with taking the first steps with Yocto here: [https://hub.mender.io/c/tutorials/yocto-project](https://hub.mender.io/c/tutorials/yocto-project)

In particular, this might cover what you are looking for: [https://hub.mender.io/t/how-to-install-packages-in-yocto-project](https://hub.mender.io/t/how-to-install-packages-in-yocto-project)

Let us know how it works out!

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [April 16, 2020, 8:27pm UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/3 "2020-04-16T20:27:41Z")

</div>

Hi @jchdel,

Welcome to Mender hub. You will need the [meta-virtualization layer](https://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization/) as a start. I don’t know the exact configuration changes needed but the docs in that layer should help.

Drew

---

<div class="post-metadata">

**Author:** ![jchdel](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/jchdel/32/681_2.png) [@jchdel](https://hub.mender.io/u/jchdel)\
**Post date:** [April 17, 2020, 2:23am UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/4 "2020-04-17T02:23:48Z")

</div>

Thanks for the links and pointers.

After quite a bit of trials and mostly errors…  
I’m currently building with

```
 BBLAYERS ?= " \
  ${TOPDIR}/../sources/poky/meta \
  ${TOPDIR}/../sources/poky/meta-poky \
  ${TOPDIR}/../sources/poky/meta-yocto-bsp \
  ${TOPDIR}/../sources/meta-mender/meta-mender-core \
  ${TOPDIR}/../sources/meta-mender/meta-mender-demo \
  ${TOPDIR}/../sources/meta-mender/meta-mender-qemu \
  ${TOPDIR}/../../meta-openembedded/meta-oe \
  ${TOPDIR}/../../meta-openembedded/meta-python \
  ${TOPDIR}/../../meta-openembedded/meta-networking \
  ${TOPDIR}/../../meta-openembedded/meta-filesystems \
  ${TOPDIR}/../../meta-virtualization \
  "

echo 'IMAGE_INSTALL_append = " docker"' >> conf/local.conf
# also enhance storage size in conf/local.conf
bitbake -c menuconfig virtual/kernel
bitbake core-image-base

```

docker is installed but doesn’t run ☹ br\_netfilter kernel module is not present…

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [April 17, 2020, 6:24am UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/5 "2020-04-17T06:24:19Z")

</div>

Docker has many Linux kernel dependencies and this can be quite frustrating to get right.

There is a helper script that you can run on your device,

```auto
wget https://github.com/moby/moby/raw/master/contrib/check-config.sh
chmod +x check-config.sh
./check-config.sh

```

This will tell you which kernel configs you are missing and need to enable.

Further make sure that you have `kernel-modules` installed as part of your image

---

<div class="post-metadata">

**Author:** ![jchdel](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/jchdel/32/681_2.png) [@jchdel](https://hub.mender.io/u/jchdel)\
**Post date:** [April 17, 2020, 8:30am UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/6 "2020-04-17T08:30:07Z")

</div>

Thanks for the hints; I finally manage to make docker run on mender image. For memory and documentation, on top of above bblayers.conf, local.conf had following changes from default:

MENDER\_SERVER\_URL = “[https://hosted.mender.io](https://hosted.mender.io)”  
MENDER\_TENANT\_TOKEN = “\*\*\*\*\*”  
MENDER\_ARTIFACT\_NAME = “release-docker-1”  
MENDER\_STORAGE\_TOTAL\_SIZE\_MB = “16384”  
MENDER\_BOOT\_PART\_SIZE\_MB = “32”  
MENDER\_DATA\_PART\_SIZE\_MB = “8192”  
DISTRO\_FEATURES\_append = " virtualization"  
IMAGE\_INSTALL\_append = " docker"  
CORE\_IMAGE\_EXTRA\_INSTALL += " kernel-modules"

and I had to add aufs module to kernel with

bitbake -c menuconfig virtual/kernel

before running

bitbake core-image-base

---

<div class="post-metadata">

**Author:** ![robert.berger](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/robert.berger/32/91_2.png) [@robert.berger](https://hub.mender.io/u/robert.berger)\
**Post date:** [April 20, 2020, 8:30pm UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/7 "2020-04-20T20:30:11Z")

</div>

On which board do you run docker?  
What is your kernel version?  
What is your yocto version?  
I am asking because I have it running without aufs. btrfs shouls works as well and on a recent version even ext4 I believe.  
Do you plan to create docker images as well with yocto?

---

<div class="post-metadata">

**Author:** ![jchdel](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/jchdel/32/681_2.png) [@jchdel](https://hub.mender.io/u/jchdel)\
**Post date:** [April 22, 2020, 6:22am UTC](https://hub.mender.io/t/how-to-generate-a-yocto-image-with-docker-engine/1800/8 "2020-04-22T06:22:37Z")

</div>

@robert.berger, you are right aufs is not needed.

I run currently my setup on two flavors of orange-pi-pc boards, a genericx86-64 board and a qemux86-64.  
It runs poky warrior 2.7.3 with Linux version 4.19.63.

current plan is to have edge devices to pull docker images from a private repo based upon docker update module. Not sure yet if it will be the right way to go…
