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

Docker blues #88

Closed
StevePoling opened this issue Aug 20, 2020 · 10 comments
Closed

Docker blues #88

StevePoling opened this issue Aug 20, 2020 · 10 comments

Comments

@StevePoling
Copy link

The Dockerfile doesn't seem to work for me. So, I made some tweaks.

  • Changed the FROM image to balenalib/rpi-raspbian:jessie to avoid a "deprecated" message.
  • added apt-get install git
  • added git clone (this repo)
  • dropped the copy of /library and /examples

This allowed me to successfully build a docker image, but when I run it I get this unhappy message:

Traceback (most recent call last):
File "larson.py", line 5, in
import blinkt
File "/usr/local/lib/python2.7/dist-packages/blinkt.py", line 5, in
import RPi.GPIO as GPIO
File "/usr/lib/python2.7/dist-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

Is there something I'm missing to tell python-rpi, or docker that I'm running on an RPi4?

MacOS wouldn't let me attach my Dockerfile. So here it is inline:

FROM balenalib/rpi-raspbian:jessie
RUN apt-get update -qy && apt-get install -qy
git
python
python-rpi.gpio
ENTRYPOINT []
RUN git clone https://github.com/pimoroni/blinkt.git /blinkt
WORKDIR /blinkt/library
RUN python setup.py install
WORKDIR /blinkt/examples/
CMD ["python", "larson.py"]

@Gadgetoid
Copy link
Member

I'm afraid the Dockerfile was contributed by @alexellis and I don't have the first clue how to get it working. I'm crossing fingers that invoking his good name will cause him to magically appear and fix all our woes, though!

@alexellis
Copy link
Contributor

Hi there. I can take a look at getting this working again, but it's going to take me a few days to set up an RPi and find a Blinkt etc.

@ptbw
Copy link

ptbw commented Aug 21, 2020

Hi
Definately not a regular docker user but I do have a Raspberry Pi 4 running Buster and Docker
I did confirm that blinkt examples worked on the Pi before creating the docker image.

Note my pi user can execute docker commands
$ sudo usermod -aG docker pi

Using the docker file below it worked for me.

FROM balenalib/rpi-raspbian:buster
RUN apt-get update -qy && apt-get install -qy \
git \
python \
python-rpi.gpio 
ENTRYPOINT []
RUN git clone https://github.com/pimoroni/blinkt.git /blinkt
WORKDIR /blinkt/library
RUN python setup.py install
WORKDIR /blinkt/examples/
CMD ["python", "larson.py"]

Built the container using:
$ docker build -t blinkt .

Execute using:
$ docker run --privileged -ti blinkt

Hope this helps.

@StevePoling
Copy link
Author

StevePoling commented Aug 21, 2020 via email

@Gadgetoid
Copy link
Member

Thanks fellow Phil @ptbw 😁

So it looks like this line in the Dockerfile should be replaced?

FROM resin/rpi-raspbian:jessie

And also some documentation tweaks to state it should be run privileged? In fact the README.md doesn't mention Docker at all.

@ptbw
Copy link

ptbw commented Aug 21, 2020

NP. @Gadgetoid

Would you like me to create a PR to update the Dockerfile and add some instructions to the readme?
(Basically expand on my comments above).

@StevePoling
Copy link
Author

StevePoling commented Aug 21, 2020 via email

@ptbw
Copy link

ptbw commented Aug 22, 2020

@StevePoling be my guest, expand on my comments and review the PR that included the original Dockerfile. It seems sensible to add a note about updating the image for the future.

@Gadgetoid
Copy link
Member

Note: I am deleting the Dockerfile as part of #102 since I have changed a lot of things, and don't have the ability to fix it.

Once #102 is merged I would welcome a PR re-adding it, if it's useful. With any luck there wont be another big change like this down the road.

@alexellis
Copy link
Contributor

I'd support that decision 😄

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

No branches or pull requests

4 participants