1 Docker Introduction
Docker is a software platform that allows the creation, testing and distribution of applications via containers.
Containers let you run your applications in resource-isolated processes. There are some similarities to virtual machines, but containers are more portable, more resource-friendly, and enables faster software delivery cycles.
Often used with docker there's a companion tool known as docker-compose: compose is used for defining and running multi-container Docker applications.
You can check Docker online documentation at:
2 Yocto Integration
Before you begin, get familiar with the
The Yocto BSP provides 2 dedicated images:
- var-image-docker: a graphic enabled image based on fsl-image-gui with the addition of a few more packages:
- var-image-docker-minimal: a console image based on the core-image bbclass with the addition of a few more packages and features:
- basic command line tools
2.2 Create a Docker-ready Image
- Follow steps 1-3 of the page.
$ cd ~/var-fslc-yocto $ MACHINE=imx8mq-var-dart DISTRO=fslc-xwayland . setup-environment build_xwayland
Append the following to the conf/local.conf file in your Yocto build directory:
DISTRO_FEATURES_append = " virtualization"
$ bitbake var-image-docker
3 Test Docker
- Check docker version:
root@imx8mq-var-dart:~# docker --version
3.1 Test hello-world
- Pull the hello-world image from Docker Hub:
root@imx8mq-var-dart:~# docker pull hello-world
- List docker images:
root@imx8mq-var-dart:~# docker images
- Run hello-world container:
root@imx8mq-var-dart:~# docker run hello-world Hello from Docker!
This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
3.2 Test Ubuntu
- Pull the ubuntu image from Docker Hub:
root@imx8mq-var-dart:~# docker pull ubuntu
- Run ubuntu:
root@imx8mq-var-dart:~# docker run -it ubuntu
root@8637148015f5:/# apt update
root@8637148015f5:/# apt install nodejs
root@8637148015f5:/# node -v
4 Test docker-compose
- Check the docker-compose version:
root@imx8mq-var-dart:~# docker-compose --version
4.1.1 RESTful-based data-logger
This archive provides an example of a RESTful-based data-logger to be deployed on an embedded device acting as an intelligent edge node in large connected networks.
Through a developed web service application based on the Tornado web framework, data can be easily inserted and retrieved from a MongoDB instance by remote devices.
In the tutorial the application is proposed as a Docker-based solution in which each component is run in a separate container.
Docker Compose is used to simplify the build of custom Docker images, their deployment, and configuration.
The application can be easily tested on any device which supports Docker and Docker Compose, be it a PC or an embedded device.
4.1.2 PyQt application
This archive provides a PyQt reference application . The Wayland graphic server is abstracted as resource to be passed to a Docker image in which the application is deployed.
In the Dockerfile the reference buster-slim image is used as a starting point, then python3 and all dependencies necessary to execute Qt applications are installed. Wayland backedn has been chosen because the only one available for all Variscite SoMs.
4.1.3 GStreamer application
This archive provides a Gstreamer test application . The Wayland graphic server is abstracted as resource to be passed to a Docker image in which the application is deployed.
In the Dockerfile the reference buster-slim image is used as a starting point, then gstreamer1.0 and all dependencies necessary to execute GStreamer applications are installed. Wayland backend has been chosen because the only one available for all Variscite SoMs.