gliderlabs / gliderlabs/docker-alpine

Python2 cannot read keyboard input device

Open
#206 2 comments 0 reactions 0 assignees View on GitHub
help wanted question
Dominant language
Shell
Stars
5.7k
Forks
530
PR merge metrics
No merged PRs in 30d

Description

I'm trying to read usb keyboard inside `alpine` docker container.
## Run container

```
# docker run --privileged --rm -it -v /dev/input:/dev/input alpine sh

/ # ls /dev/input/by-path/
pci-0000:00:01.2-usb-0:1:1.0-event-mouse platform-i8042-serio-1-event-mouse
pci-0000:00:01.2-usb-0:1:1.0-mouse platform-i8042-serio-1-mouse
platform-i8042-serio-0-event-kbd platform-pcspkr-event-spkr
```
## Run python2 (Raise error)

```
/ # apk add -U python
/ # python
Python 2.7.12 (default, Jun 29 2016, 08:57:23)
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> kbd = open('/dev/input/by-path/platform-i8042-serio-0-event-kbd', 'rb')
>>> kbd.read(16)
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 22] Invalid argument
>>> exit()
```
## Run python3 (No error)

```
/ # apk add python3
/ # python3
Python 3.5.1 (default, May 30 2016, 16:01:04)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> kbd = open('/dev/input/by-path/platform-i8042-serio-0-event-kbd', 'rb')
>>> kbd.read(16)
^C
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.