Docker is a well-known containerization platform and is increasingly being adopted by developers and administrators. You can use Docker tooling and ecosystem to develop applications for IOx. The following list shows some of the advantages to using Docker:
- Most developers are familiar with using Docker tools to create Docker images.
- Docker hub hosts a variety of container images, some of them very minimalistic and suitable for IoT gateway devices (for example, alpine, busybox, and so forth).
- The base Docker images are also supported by distro specific repositories helping developers to easily get libraries, binaries needed for their applications without having to worry about compiling them from sources and resolving dependencies (e.g.
apk add nodejs
)
- Docker and its ecosystem tools are well documented.
For an overview of this application type see:
Docker style applications
As a convenience, a prebuilt VM ova that has all the necessary IOx development tools, including docker and ioxclient, is available for downloading at Downloads Section "IOx SDE". This VM ova file is imported into any VMWare hypervisor that emulates the development guest-os. Refer to Section "Setup Type 2 KVM Hypervisor Development Environment" for available VMWare hypervisor information.
Prerequisites
- Docker >= 1.12 (preferred would be 1.26) installed on your development machine
- Latest
ioxclient (>=1.4.0)
installed on your machine
Caveats and Restrictions
Developers use existing Docker tooling to create Docker images that can be then packaged into IOx compatible applications. Only IOx software development environment is dockerized.
To check whether your target IOx platform supports docker style application, look at Platform Matrix
The contents of the Docker image is interpreted and composed to create a LXC container root file system on the target environment.
In general IOx supports all build specific Docker instructions. However, only a subset of Dockerfile run specific instructions are supported. See the table below for the list of supported instructions:
Dockerfile Instructions |
IOx Support |
Comments |
FROM |
Yes |
|
MAINTAINER |
Yes |
|
RUN |
Yes |
|
ADD |
Yes |
|
COPY |
Yes |
|
ONBUILD |
Yes |
|
LABEL |
Yes |
|
SHELL |
Partial |
Yes for RUN instruction ONLY. |
CMD |
Yes |
|
EXPOSE |
Yes |
|
ENV |
Yes |
|
ENTRYPOINT |
Yes |
|
VOLUME |
Yes |
|
USER |
Yes |
Used to set the start up user ID and start point in the new Docker image. |
WORKDIR |
Yes |
|
ARG |
No |
|
STOPSIGNAL |
No |
|
HEALTHCHECK |
Yes |
|
- The IOx application created using a Docker image is run using LXC and AUFS on a compatible IOx platform. None of the IOx platforms run the Docker daemon natively.
- The package descriptor file (package.yaml) is used to define the IOx application requirements. For Docker type applications, it is not mandatory to create an application descriptor file. ioxclient creates a default package descriptor file. You can add additional attributes or modify defaults values using LABEL instruction in Dockerfile (Ex. LABEL cisco.cpuarch=x86_64).
- Docker images that are heavily dependent on constructs provided by Docker (e.g. Dockerfile commands) WILL NOT run out of the box. Use equivalent attributes in Dockerfile or package.yaml if available. (For example ENV Dockerfile constructs can be translated to package.yaml's app->env section.)
- Docker apps MUST bring the entire rootfs as part of the application package. The rootfs MUST be in Docker image format, which is a tar ball that preserves all layers and layer information from the Docker image.
- Docker style apps CANNOT use any cartridges that are available on the platform.
- Docker style apps MUST not use any init system for container startup. The target command to be run is a user defined process.
- Although it is possible to run any Docker image, the image size should be compatible with the available resources on the platform.
Note About Base Images
We recommend that you use base images that are minimal in size (for example, alpine
). IOx application packages that are smaller in size and can fit into the available resources on the platform.
Required Developer Skills
Developers are expected to be familiar with the process of working with Docker and creating docker images.
In addition, they are expected to:
- have an intermediate understanding of Linux including: rootfs, partition, system initialization, and package installation.
- be familiar with how to build a Linux application.
- customize and configure linux systems.
The following diagram shows a high level workflow for how to create IOx applications using Docker tools and images.
