LDV Tools in Docker

Actual Images

At the moment the only image available is LDV Tools 0.8.
MD5: 40accf5d0ab7321a3a40014013c03de4

Description

This file describes steps to deploy ldv-tools software verification system
from master branch of ldv-tools repository with help of docker. More details
about system usage are available in corresponding tutorials stored in the
ldv-tools repo.

This package should contain english and russian tutorials and two docker images:

  • debianldv.tar - image with ldv installed ldv console tools and web interface;
  • mysql.tar - image with a mysql-server, database for verification results and
    script for its initialization.

Deployment

  1. Install Docker on your machine according to official tutorial. Provided below version may help if your docker version does not support these images. Images were built with Docker having following version:
    $ sudo docker version
    Client version: 1.5.0
    Client API version: 1.17
    Go version (client): go1.4.1
    Git commit (client): a8a31ef
    OS/Arch (client): linux/amd64
    Server version: 1.5.0
    Server API version: 1.17
    Go version (server): go1.4.1
    Git commit (server): a8a31ef
    
  2. Load your images to Docker on the host machine:
    $ sudo docker load -i debianldv.tar
    $ sudo docker load -i mysql.tar
    

    After loading you will have two available images on your host:
    $ sudo docker images
    ldv-tools/debianldv           latest              ff073a36d5be        23 hours ago        2.716 GB
    ldv-tools/mysql               latest              4607ef975bea        3 days ago          260.8 MB
    

Run containers

Warning! Before running containers make sure that nobody uses ports listed
below:

  • 3306 - usually it is claimed by mysql-server;
  • 8999 - largely nobody uses it.

Run container with mysql-server.

  1. Run ldv-tools/mysql container in a daemon mode on your host machine:
    $ sudo docker run -p 3306:3306 -d ldv-tools/mysql
    
  2. Now you can connect from your host to the mysql-server in a container. Verification results will be stored in the database "ldvbase" which can be managed by user "ldvuser" with no password:
    $ mysql -u ldvuser --protocol=TCP
    
  3. Next it is required to access database from other container, so it is necessary to obtain mysql container's IP address first. Perform on host:
    $ sudo docker ps
    

    Remember the ID of mysql container and run command to get its IP address:
    $ sudo docker inspect --format='{{.NetworkSettings.IPAddress}}' <MYSQL cont. ID>
    
  4. There is no any other required actions to perform with the container, just keep it alive. The other instructions are concerned with the main ldv image and its container.

Run container with ldv-tools

  1. Prepare host directory with Linux sources to share with the container in a read and write mode (you can choose your own path instead of /host/work):
    $ mkdir /host/work
    $ cp linux-3.17-rc1.tar.xz /host/work
    $ cd /host/work
    
  2. Run container with ldv-tools (option "--privileged=true is required for control croups mounting, since docker restricts it inside a container by default):
    $ sudo docker run -i -t -v "/host/work:/work:rw" --privileged=true -p 8999:8999 ldv-tools/debianldv /bin/bash
    
  3. Run inside a container command:
    # recursive_cg_mounter
    
  4. You may need to start apache2 inside a container explicitly:
    # service apache2 start
    

Run verification

  1. Now you can perform verification inside ldv container in an interactive mode. Results will be stored in finished/ dir in a pax archive. The most frequent problem is that host systems have disabled swap accounting. You can use LDV without swap account at your own risk. More information is available in ldv-tools repository in the files INSTALL, TUTORIAL, README and others. Repository is not included in the containers to save disk space. Set LDV_WORK_WITHOUT_SWAP_ACCOUNT environment variable for that. There is an example:
    # RCV_MEMLIMIT=5Gb RCV_TIMELIMIT=100 ldv-manager envs=linux-3.17-rc1.tar.xz  kernel_driver=1 "drivers=drivers/net/usb/cdc-phonet.ko" "rule_models=32_7a" 
    

Explore results

  1. Upload results from debianldv container to container with mysql (remember that this IP address we already obtained few steps above):
    # LDVDB=ldvbase LDVDBHOST=<MYSQL container IP> LDVUSER=ldvuser ldv-upload-2 finished/yours.pax
    
  2. Now you can analyze your results in a browser from your host machine or even connecting from a remote host. Just type the address:
    http://localhost:8999/stats/index/profilename/default/name/ldvbase/user/ldvuser/host/<MYSQL container IP>/
    
  3. To share your results use host name or host IP instead of localhost.

Finish work

  1. To terminate containers use just "exit" in a container running interactive mode and commands "sudo docker ps" and "sudo docker kill <id>" for containers started in a daemon mode.
  2. Do not forget to dump your mysql base from corresponding container if you are planning its further usage, since information in destroyed containers is flushed.