Using Multiple Docker Containers

By default, libpxl inside a Docker container runs in standalone mode. In this mode, device resources are not shared across processes or containers.

To run multiple containers (or multiple processes across containers) sharing the same XCENA device, you need to run pxl_resourced on the host and connect each container to it via a shared FIFO.

Prerequisites

  • XCENA driver installed on the host
  • pxl_resourced installed and running on the host
  • Docker Engine installed on the host

1. Install libpxl on the host

The host needs libpxl (which includes pxl_resourced) installed so it can manage device resources across containers.

If you have the SDK package:

wget <URL_to_sdk_xxx.tar.xz>
tar -xvf sdk_xxx.tar.xz
cd sdk_xxx/lib/pxl
sudo dpkg -i libpxl_*.deb

Or copy the deb package from an existing Docker container:

# e.g., docker cp xcena_sdk:/work/lib/pxl/libpxl_*.deb ./
docker cp <container>:/work/lib/pxl/libpxl_*.deb ./
sudo dpkg -i libpxl_*.deb

2. Verify pxl_resourced is running on the host

Installing the libpxl deb package automatically registers pxl_resourced as a systemd service. Verify that it is running:

systemctl status pxl_resourced

Verify that the service FIFO is created:

ls -la /tmp/pxl/service_pipe

3. Run Docker containers

Start each container with the following options to connect to the host daemon:

docker run -it --privileged \
  --pid=host \
  --userns=host \
  -v /tmp/pxl:/tmp/pxl \
  --name <container> xcenadev/sdk:<tag>
Option Purpose
--privileged Grants access to host devices
--pid=host Shares the host PID namespace
--userns=host Shares the host user namespace
-v /tmp/pxl:/tmp/pxl Mounts the FIFO directory for daemon communication

4. Verify

Inside each container, check that the host daemon’s FIFO is visible:

ls -la /tmp/pxl/service_pipe

Then verify device access:

xcena_cli num-device

Both containers should report the same device(s).

Security note: --privileged, --pid=host, and --userns=host reduce container isolation. Use these options only in controlled environments with trusted images.