# Use of Docker containers

Qualcomm Linux enables Docker containers. To use Docker containers, ensure that Qualcomm
BSP has enabled the virtualization features. To use containers on
Qualcomm Linux devices, ensure that the `meta-virtualization` layer is enabled as
part of the workspace.

## Docker

The `qcom-multimedia-image` enables Docker:

1. For the `qcom-multimedia-image` image recipe,
`packagegroup-qcom-containers` is included using
`meta-qcom-distro/recipes-products/packagegroups/packagegroup-qcom-multimedia.bb`.
2. The `packagegroup-qcom-containers` is defined in the `meta-qcom-hwe` layer at
`dynamic-layers/virtualization-layer/recipes-containers/packagegroups/packagegroup-qcom-containers.bb`.
3. After the image is built and flashed, Docker is available on the
device.
4. To verify kernel compatibility, run the `check-config.sh` script
on the device.
5. To verify the configuration, enable the required kernel
configurations and rebuild the image. For more
information, see [Kernel
compatibility](https://docs.docker.com/engine/install/troubleshoot/#:~:text=Kernel%20compatibility,check%2Dconfig.sh%20script.&amp;text=The%20script%20only%20works%20on%20Linux).
6. To verify the status of the Docker daemon, run the following command and verify the output:

    | Command | Description | Output |
    | --- | --- | --- |
    | `systemctl status docker` | If Docker commands have been run at least once after boot-up | Active (running) |
    | `systemctl status docker` | If the device has not run any Docker commands after boot-up | Inactive (dead) |
    |  |  |  |

The images pulled from the Docker repository for the `linux/arm64` platform and tested to run successfully on the device are as follows:

> 
> 
> - `busybox`
> - `python`
> - `alpine`
> - `ubuntu`
> - `postgres`
> - `mongo`
> - `nginx`
> - `redis`

The following use cases are verified with Docker enabled:

- Load Docker images from tar files using the Docker load utility.
- Build a Docker image from the Docker file.
- Save Docker images that were pulled/built into a `.tar` file.
- Load Docker images, which are saved as `.tar` files.
- Run multiple container instances of multiple images pulled/built.
- Verify the list of Docker images loaded on the device.
- Verify the list of active and total containers on the device.
- Inspect Docker images using the Docker inspect utility.
- Obtain logs from a container using the Docker logs utility.
- Stop and kill the container using the Docker stop and Docker kill utilities.
- Remove containers and Docker images from the device.

## Hardware node access from Docker

The applications running inside a Docker container may need access to device nodes and
files on the device (that is, device is the host for the Docker container). Pass the respective
device nodes as an option with the run command for Docker to perform this task:

docker run -it --rm --device=<device-1> --device=<device-2> <docker-image-name>
    Copy to clipboard

Pass the device nodes located in the `/dev` directory on the device.
Depending on the use case, for example, in a graphics scenario, pass
`/dev/kgsl-3d0` to Docker using `--device=/dev/kgsl-3d0`.

Applications running inside a Docker container may also need access to storage on the device (target-host).
To expose files/directories as bind mounts, run the following command:

docker run -it --rm --mount type=bind,source=<source-path-on-device>,target=<destination-path-inside-container> <docker-image-name>
    Copy to clipboard

Run a docker container exposing multiple directories, files, and
device nodes to the container using the following command:

docker run -it --rm --device=<device-1> --device=<device-2> --mount type=bind,source=<source-path-on-device-1>,target=<destination-path-inside-container-1>  --mount type=bind,source=<source-path-on-device-2>,target=<destination-path-inside-container-2> <docker-image-name>
    Copy to clipboard

## Run Docker Compose on Qualcomm Linux devices

Docker Compose is a tool for defining and running multicontainer applications.
It streamlines managing the application stack by defining services, networks,
and volumes in a single, comprehensible YAML configuration file. By default,
the Qualcomm Linux release includes Docker Compose in `qcom-multimedia-image`.

The `docker-compose` package is added to the `packagegroup-qcom-multimedia` package group in the `meta-qcom-distro` metadata layer
through `packagegroup-qcom-containers`.

**To run Docker Compose on the device:**

1. Create or copy the Docker Compose YAML files under the writable path on a
device such as `/var` (for example `/var/docker-compose-yaml`)
to be used with Docker Compose on the device.
2. Ensure that the Docker images listed in your Docker Compose YAML
files are available on the device. If not, the device should be
connected to a valid Internet connection to pull the docker images.
3. To run Docker Compose for multiple YAML files, run the following
command:

docker-compose -f <docker-compose-file-1>.yml -f <docker-compose\u0002file-2>.yml up
        Copy to clipboard

Docker Compose runs and initiates the Docker containers as configured
in the Docker Compose YAML file. After the Docker Compose command
returns, run `docker ps -a` and `docker logs <conatiner-id>` to
verify if the docker containers are running as expected.

To know more about Docker Compose, see [Docker Compose overview](https://docs.docker.com/compose).

Last Published: Jul 02, 2025

[Previous Topic
Manage partitions in Qualcomm Linux](https://docs.qualcomm.com/bundle/publicresource/80-70020-27/topics/managing_partitions_in_qualcomm_linux.md) [Next Topic
Set up Kubernetes with Qualcomm Linux](https://docs.qualcomm.com/bundle/publicresource/80-70020-27/topics/setup_kubernetes_with_qualcomm_linux.md)

Source: [https://docs.qualcomm.com/doc/80-70020-27/topic/use_of_docker_containers.html](https://docs.qualcomm.com/doc/80-70020-27/topic/use_of_docker_containers.html)