Skip to content

Docker device setup

LAVA can use docker as a DUT and run test under Docker.

Create device-type

Create a device-type in the admin interface.

The only relevant information is the device-type name that should be docker.

Command line
lavacli device-types add docker
lava-server manage device-types add docker

Create device

Create a docker device in the admin interface:

  • hostname: name of the device
  • device-type: docker
  • worker host: worker that will run the job
Command line
lavacli devices add --type docker --worker <worker> <hostname>
lava-server manage devices add \
    --device-type docker \
    --worker <worker> \
    <hostname>

Device configuration

In order to submit jobs to the newly created device, LAVA requires a device dictionary. For a simple docker job, this device dictionary would work:

{% extends "docker.jinja2" %}

This file should be pushed to the LAVA server under /etc/lava-server/dispatcher-config/devices/<hostname>.jinja2.

Command line

lavacli devices dict set <hostname> <filename>
cp <filename> /etc/lava-server/dispatcher-config/devices/<hostname>.jinja2
chown lavaserver:lavaserver /etc/lava-server/dispatcher-config/devices/<hostname>.jinja2

Activate the device

By default, a new device is put in maintenance.

As the device is now configure, admins can put it online in the device page.

Command line
lavacli devices update --health UNKNOWN <hostname>
lava-server manage devices update --health UNKNOWN <hostname>

Submit a job

Submit this simple test job:

device_type: docker
job_name: simple docker test

timeouts:
  job:
    minutes: 10
visibility: public
priority: medium

actions:
- deploy:
    to: docker
    image: debian:buster
    os: debian
- boot:
    method: docker
    command: bash
    prompts: ['root@lava:/']
- test:
    definitions:
    - from: inline
      name: env-dut-inline
      path: inline/env-dut.yaml
      repository:
        metadata:
          format: Lava-Test Test Definition 1.0
          name: smoke-tests-basic
        run:
          steps:
          - printenv