1. Summary for CC Linux with Docker

Changes were made to the Yocto generated build of CC Linux to provide support for Docker. Docker support is provided through the “docker-ce” package on Linux and Yocto platforms. There are three applications that are recommended to add, docker-ce, docker-ce-contrib, and python3-docker-compose. The CC Linux with Docker version includes all of these packages.

A separate packagegroup Bitbake(bb) file was created by using the virtualization parameter with the necessary additional applications added to create a disctinct image with Docker support. This results in two versions of CC Linux 3.0 being available, one with docker support and one without, available depending on system requirements.

1.1 Implementation of Docker

The virtualization parameter has been included to add Docker support to the system. If it is desired to be enabled for a Docker system, the comment must be removed from platform/XXX/local.conf file.

# Enable virtualization
# Defining this will enable the kernel module, and install docker in to the image.
# DISTRO_FEATURES:append = " virtualization”

This virtualization parameter is associated with the packagegroup-docker-ce.bb file. This connection was made with the IMAGE_INSTALL usage in the cc-linux-image.bb file.

In the cc-linux-image.bb file, using the bb.utils.contains method, packagegroup-docker-ce.bb under the meta-cc layer was inherited and Docker packages were imported indirectly. This packagegroup file can be found under the meta-cc layer. Path: meta-cc/meta-cc-distro/recipes-core/packagegroups/packagegroup-docker-ce.bb

# Install docker as default if virtualization is enabled.

IMAGE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES','virtualization','packagegroup-docker-ce','',d)}"

After these processes, Yocto build should be started, and the created image should be burnt to the device.

1.2 Running Docker on the Product

After the image is burnt to the system and booted, docker will be available. After log-in, to check if docker is installed on the device use the following command.

ccs@v1200:~# sudo docker --version
Docker version 20.10.12-ce, build 62eae52c2a

After checking the installation of Docker with version command, developers can launch a basic application and test that Docker is fully functional. For this purpose, start the Docker service first on the system.

ccs@v1200:~# sudo systemctl start docker
ccs@v1200:~# sudo systemctl status docker
● docker.service - Docker Application Container Engine
    Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
    Active: active (running) since Thu 2023-04-27 09:50:10 UTC; 22h ago
TriggeredBy: ● docker.socket
    Docs: https://docs.docker.com
Main PID: 630 (dockerd)
    Tasks: 10 (limit: 1709)
    Memory: 112.1M
    CGroup: /system.slice/docker.service
            └─630 /usr/bin/dockerd -H fd://

Then start the Docker “hello-world” test application and observe that Docker is fully installed and ready to run. Complete this test by generating a printout as shown below.

ccs@v1200:~# sudo 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.
    (arm64v8)
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.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/