Docker is an open source software platform for setting up and running applications in packaged environments called containers. This virtualization at the operating system level enables you to run an application as a single, predictable package.

See the Docker documentation for more detailed description and instructions on getting started with Docker.

You must set up your PC workstation to use Docker:

Requirements

  • A 64-bit Linux machine with Internet connection.

  • A Linux distribution supported by the Yocto Project.

  • 8 GB of RAM.

  • 8 CPU cores.

  • 250 GB of free disk space. SSDs are highly recommended for faster build times.

1. Install and set up the Docker engine

  1. Install the Docker for Ubuntu Linux distribution:

    ~$ sudo apt-get install docker.io
  2. Add your user to the docker group to avoid having to run every Docker command as root.

    ~$ sudo usermod -a -G docker "$(whoami)"
  3. After you add your user to the docker group, reboot or log out for the group assignment to take effect.

2. Download and run Digi Embedded Yocto Docker image

Digi Embedded Yocto provides a fully configured and ready to use Docker image based on an Ubuntu 18.04 Linux distribution. Follow these steps in your Linux machine to download and run the Digi Embedded Yocto Docker image:

2.1. Download Docker image

~$ docker pull digiembedded/dey:dey-3.0-r4

2.2. Create a workspace

Create a workspace folder in your host system.

For the shared folder between the host and the container, Digi recommends using a different storage media than the one the operating system is running (preferably SSD for improved build times).
~$ mkdir <HOST_PATH_TO_WORKSPACE>

Docker uses this location to store platform projects as well as the following shared folders:

  • downloads/: This directory contains downloaded upstream source tarballs. Sharing this folder across builds by setting DL_DIR on your project conf/local.conf helps decrease build times.

  • sstate-cache/: This directory contains the shared state cache. Sharing this folder across builds by setting SSTATE_DIR on your project conf/local.conf helps decrease build times.

A typical project stores several GB on these two directories, so it is good practice to share these folders across different projects. When you create the project using the automatic script that runs with the container, the project conf/local.conf gets configured to use these directories.

2.3. Create and start a new Docker container

Create and start a new Docker container based on the Docker image for Digi Embedded Yocto:

~$ docker run -it --name dey-3.0-container
                   --volume <HOST_PATH_TO_WORKSPACE>:/home/dey/workspace
                   digiembedded/dey:dey-3.0-r4

Arguments in this command:

  • -it (short for -i -t) allocates a pseudo-TTY console to operate the container.

  • --name assigns the name dey-3.0-container to the new container.

  • --volume mounts the host workspace directory on the container directory /home/dey/workspace.

Command prompts inside a Docker container follow the format <username>@<container_id>. username is the default user name inside the container, and container_id represents the unique container ID assigned by Docker during container creation.

Your Docker container with the name dey-3.0-container starts automatically and is ready to use.

+------------------------------------------------------------------------------------+
|                                                                                    |
|                                                                                    |
|                   Welcome to Digi Embedded Yocto Docker container                  |
|                                                                                    |
|  This Docker image is a ready to use system based on Digi Embedded Yocto (DEY) to  |
|  build custom images for the Digi platforms. DEY is an open source and freely      |
|  available Yocto Project (TM) based embedded Linux distribution.                   |
|                                                                                    |
|                                                                                    |
+------------------------------------------------------------------------------------+

Do you wish to create a new platform project [Y/N]?
Press Y to create a new project, or N to get to the prompt in the container.

Update Digi Embedded Yocto in the container

The container has Digi Embedded Yocto installed in /usr/local/dey-3.0. The installed version is the last release that was available when the Docker image was created, which may not be up to date. To update Digi Embedded Yocto:

dey@b53778495448: cd /usr/local/dey-3.0/
dey@b53778495448: repo sync -j 4

Useful Docker commands

Start a stopped container
~$ docker start --attach 'dey-3.0-container'
List all Docker containers (running or stopped)
~$ docker ps --all
See the Docker documentation for more commands and instructions.