Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Docker and Vagrant support #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Manouchehri
Copy link

Example usage:

mbp:lglaf dave$ vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Cloning VMware VM: 'bento/ubuntu-16.04'. This can take some time...
==> default: Checking if box 'bento/ubuntu-16.04' is up to date...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for the VM to receive an address...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Configuring network adapters within the VM...
==> default: Waiting for HGFS to become available...
==> default: Enabling and configuring shared folders...
    default: -- /Users/dave/lglaf: /vagrant
==> default: Running provisioner: docker...
    default: Installing Docker onto machine...
==> default: Starting Docker containers...
==> default: -- Container: thawsystems/lglaf
mbp:lglaf dave$ vagrant ssh
vagrant@vagrant:~$ docker attach lglaf
vagrant@vagrant:~$ docker attach lglaf
root@14d9056e4d77:~# lglaf.py
No handlers could be found for logger "LGLAF.py"
LGLAF.py by Peter Wu (https://lekensteyn.nl/lglaf)
Type a shell command to execute or "exit" to leave.
# whoami
root
# id
uid=0(root) gid=0(root) groups=0(root) context=u:r:kernel:s0

pip install pyusb && \
su - lglaf -c "git clone https://github.com/Lekensteyn/lglaf.git" && \
cp -v ~/lglaf/rules.d/42-usb-lglaf.rules /etc/udev/rules.d/ && \
udevadm control --reload-rules || true && \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this || true looks wrong.

Since you have an isolated container anyway, you could also consider a chgrp lglaf /dev/usb/*/* I guess.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just so Dockerhub doesn't bail out on building.

Won't that break hotplugging?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped that inotify works also in Docker containers, then you do not need any udevadm command. If you can do hotplugging, try checking for events with udevadm monitor while your container has started.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

udevadm monitor sees the kernel plug events, but doesn't apply udev rules. udev seems to refuse since it detects that it's a container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants