Pymakr in Docker

  • For anyone having issues with the pymakr prerequisites, a Docker container appears to be helpful. My Dockerfile is appended, although I only have it working for "locally attached" devices. The pymakr deb you want to use should be in the debdir/ subdirectory. I'm still trying to figure out forwarding that will let the Docker-based pymakr reach a remotely connected LoPy. SSH SOCKS forwarding works for remotely network connected devices given pymakr running directly and not in a container, but forwarding from within a container is more complicated.

    (Ok, it appears "file upload" doesn't work. Just pasting, so no idea how it'll be formatted.)

    FROM debian:jessie
    RUN apt-get update && apt-get install -y pyqt4-dev-tools python-qscintilla2 git sudo python-qt4-sql firefox-esr python-pygments python-chardet python-serial
    COPY debdir /debdir
    RUN sh -c 'dpkg -i /debdir/*.deb'

    Apparently, the uid and gid must match the running user... Have not tested.

    RUN export uid=1000 gid=1000 &&
    mkdir -p /home/developer &&
    echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd &&
    echo "developer:x:${uid}:" >> /etc/group &&
    echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer &&
    chmod 0440 /etc/sudoers.d/developer &&
    chown ${uid}:${gid} -R /home/developer

    USER developer
    ENV HOME /home/developer

    #RUN cd /home/developer && git clone && cd Pymakr && sudo python -- nope, see their kitchen repo
    CMD /usr/bin/pymakr

    Assuming the container is named pymakr, use the following to run:

    docker run -ti --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/.Xauthority:/home/developer/.Xauthority --net=host --pid=host --ipc=host pymakr

    Add --device=/dev/ttyUSB0 for the serial port when already connected

  • Ok, some of the bolded lines are prefixed by # for comments. ugh.

    And I have to wait three minutes because I'm a new user. Goodie.

Log in to reply

Pycom on Twitter