Hi,
We’re using a Keylok HID device inside a docker container.
We tried to run it inside a docker container on an Ubuntu 14.04 host sytem.
This works using the following dockerfile:
FROM ubuntu:14.04
RUN apt-get update -y && apt-get install -y build-essential libudev1 libudev-dev
WORKDIR /home/root/code
ADD code .
RUN chmod +x /home/root/code/keylok_install/keylok_install
RUN cd /home/root/code/keylok_install && ./keylok_install
RUN cd /home/root/code/Demo && make
#run demo program manually inside the container, so just sleep for now
CMD /bin/bash -c 'while true; do sleep 86400; done'
#CMD /home/root/code/Demo/demoA
We execute following docker commands:
docker build -t testkeyimage .
docker run -d --name keytest --privileged testkeyimage:latest
Inside the container we have the following permissions for our HID device:
root@6a6fd6dc3d4d:/home/root/code# ls -la /dev/usb/hiddev0
crw-rw-rw- 1 root root 180, 0 Jun 7 11:09 /dev/usb/hiddev0
When we execute the demo program inside the container we get the following output:
root@6a6fd6dc3d4d:/home/root/code# ./Demo/demoA
KEY-LOK (TM) SECURITY SYSTEM DEMONSTRATION
(C) Copyright 1982 - 2013 - All Rights Reserved
By: KEYLOK
800-4-KEYLOK (800-453-9565)
What would you like to do?
A = Perform check for proper device.
M = Exit from program.
a
The proper KEY-LOK security device is attached.
Dongle Type = 2.
Depress ENTER key to continue.
This functions the same as outside the container.
In resin we run the docker container as a docker-compose service:
keylok:
build: ./device-core-keylok
privileged: true
On the resin host OS we have the following permissions for our HID device:
root@82ea18a:~# ls -la /dev/usb/hiddev0
crw------- 1 root root 180, 96 Jun 7 11:25 /dev/usb/hiddev0
Inside the docker container on the resin host OS we have the same permissions for our HID device:
root@26e76214f1b6:/home/root/code# ls -la /dev/usb/hiddev0
crw------- 1 root root 180, 96 Jun 7 11:25 /dev/usb/hiddev0
These permissions are different than on the Ubuntu host pc, but this should not matter since we are root anyway. (root has rw access)
When we execute the demo program inside the container on the resin OS host we get the following output:
root@6a6fd6dc3d4d:/home/root/code# ./Demo/demoA
KEY-LOK (TM) SECURITY SYSTEM DEMONSTRATION
(C) Copyright 1982 - 2013 - All Rights Reserved
By: KEYLOK
800-4-KEYLOK (800-453-9565)
What would you like to do?
A = Perform check for proper device.
M = Exit from program.
a
No KEY-LOK or wrong KEY-LOK device attached.
Depress ENTER key to continue.
The demo program does not work in the docker container on the resin OS host.
What could be the cause for this?
Thanks in advance!