Skip to main content
Version: scarthgap_2-x

Using Docker

Overview

This page provides a practical guide to using Docker on Clea OS, including how to verify the Docker installation, run containers, and perform common management operations.

Docker is pre-installed and fully integrated into Clea OS.
It enables developers to build, run, and manage isolated containerized applications directly on embedded devices, ensuring clean environments and repeatable deployments.


Verifying Docker Installation

Once Docker has been integrated into Clea OS and the image is built and flashed to the target device, verify the installation with:

# docker info

This command displays detailed information about the Docker installation, including version, container statistics, storage driver, and system resources.

Example Output:

root@nxp-imx93evk:~# docker info
Client:
Version: 25.0.3
Context: default
Debug Mode: false

Server:
Containers: 4
Running: 0
Paused: 0
Stopped: 4
Images: 1
Server Version: 25.0.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b1624c3628954e769dd50783b63823040b2db38c.m
runc version: v1.1.12-2-ga9833ff3-dirty
init version: b9f42a0-dirty
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.6.23-gb586a521770e
Operating System: Clea OS Distro 5.0.2 (scarthgap)
OSType: linux
Architecture: aarch64
CPUs: 2
Total Memory: 1.836GiB
Name: nxp-imx93evk
ID: 176fbfae-5992-40ec-8d9e-acb529ee76e6
Docker Root Dir: /opt/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
note

If the docker command is not found, verify that Docker is included in your image build and that the dockerd service is running using systemctl status docker.


Running a Test Container

To confirm that Docker is functioning correctly, run the hello-world test container:

# docker run hello-world

This command pulls the hello-world image from Docker Hub (if it is not already available) and runs it.
It outputs a confirmation message indicating that Docker is working as expected.

Example Output:

root@nxp-imx93evk:~# 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

Checking Docker Version

To confirm the installed Docker version:

# docker --version

Example output:

Docker version 25.0.3, build 1234567

Common Docker Commands

Here are some frequently used commands to manage containers and images on Clea OS:

# docker ps             # List running containers
# docker ps -a # List all containers (including stopped)
# docker images # List available images
# docker pull alpine # Download a lightweight Alpine image
# docker rm <id> # Remove a container
# docker rmi <image> # Remove an image
tip

Use docker ps -a to check for exited containers that might still consume disk space.


Running Containers

Run a Simple Container

# docker run hello-world

This command verifies that Docker can pull and execute images successfully.

Run a Container Interactively

# docker run -it alpine sh

This starts an interactive session inside a minimal Alpine Linux container.

Run a Container with a Mounted Volume

# docker run -it -v /data:/mnt/data alpine sh

This mounts the /data directory from the host system into /mnt/data inside the container.

Run Containers in the Background

# docker run -d --name web-server -p 8080:80 nginx

This runs an Nginx web server container in detached mode (-d), mapping host port 8080 to container port 80.


Viewing Container Logs

To view logs generated by a running or stopped container:

# docker logs <container_id>

To follow logs in real time:

# docker logs -f <container_id>

You can also use docker ps to list container IDs.


Cleaning Up Docker Resources

To stop and remove a container:

# docker stop <id>
# docker rm <id>

To remove unused images:

# docker rmi <image>

To perform a full cleanup of unused containers, images, and volumes:

# docker system prune -a
warning

Use docker system prune -a with caution, as it will remove all stopped containers, unused images, and dangling volumes.


Summary

Docker on Clea OS provides a flexible environment for developing, testing, and deploying containerized applications in embedded systems.
You can verify the Docker installation, run test containers, mount data volumes, and manage lifecycle operations using the same commands available on any standard Linux distribution.

By following these steps, you can confidently use Docker within Clea OS for application isolation, repeatable builds, and consistent runtime behavior.