Unable to run "make install" in Dockerfile.template


I am trying to build a program to run with a Raspberry Pi Mega-IO Card.

My issue comes when the program runs sudo make install on the device. The confusing thing, however, is that everything builds fine on the CLI and is pushed to the devices. (the issue comes in the logs on the device dashboard)

Here is my Dockerfile.template code:
FROM resin/%%RESIN_MACHINE_NAME%%-python

#Switch on systemd init system in container

#Gotta get those requirements
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt

#We need the WiringPi GPIO stuff
RUN git clone git://git.drogon.net/wiringPi
CMD cd wiringPi
CMD ./build

#Now we need the MegaIO stuff
RUN git clone repository.here.megaio-rpi.git (had to cut off half of this link because new users can only post two hyperlinks in a post)
CMD cd megaio-rpi
CMD sudo make install

And here is the Repository I’m pulling from: Github Repo here

I have no clue what the problem is, as I am still learning about this awesome new tool! Any help would be appreciated!


Hi @tate !

The problem is in using sudo – this won’t work with a Dockerfile because the commands are already running as root, and root doesn’t have access to the sudo command.

So I suspect changing sudo make install to make install should fix that right up.

Let us know if that worked!

Thanks for the quick response!

After I made the change you described, here is what I ran into:

28.04.18 19:30:19 (-0400) main Systemd init system enabled.
28.04.18 19:30:20 (-0400) main systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
28.04.18 19:30:20 (-0400) main Detected virtualization ‘other’.
28.04.18 19:30:20 (-0400) main Detected architecture ‘arm’.
28.04.18 19:30:20 (-0400) main Set hostname to .
28.04.18 19:30:47 (-0400) main make: *** No rule to make target ‘install’. Stop.
28.04.18 19:30:47 (-0400) main make: *** No rule to make target ‘install’. Stop.
28.04.18 19:30:48 (-0400) main make: *** No rule to make target ‘install’. Stop.
28.04.18 19:30:48 (-0400) main make: *** No rule to make target ‘install’. Stop.
28.04.18 19:30:49 (-0400) main make: *** No rule to make target ‘install’. Stop.

By the way, here is a link to the GitHub Repository with my files: Link here
I’d like to apologize if this reply was posted 3 times. I have no idea what I’m doing and was not able to tell if the reply actually replied, because it says that I didn’t reply for me :grin:

There’s a few things that stand out to me, first the requirements.txt seems to be empty, so pip is giving an error there. Should there be something in there for the python dependencies you’re using? This might be causing some compilation or execution failures.

I also noticed the docker file is missing the final CMD section to execute the main program, https://github.com/resin-io-projects/simple-server-python/blob/master/Dockerfile.template has a example CMD for python – that’s why you’re seeing the repeated make install messages as it doesn’t know what else to do.

And try adding the WORKDIR /usr/src/app to your dockerfile so all the COPY and RUN commands are executed in the right directory in case any of those are going to the wrong place now

Reading the wiringPI docs it looks like the build script tries to run sudo on install, that might be failing as well – Would installing the pre-build package using apt-get (see python example above) work just as well? Otherwise you might have to patch the script.

Finally you might want to remove the source trees for wiringPI and MegaIO after installing them to make the container image a good bit smaller – no need to include the source for those on the device right.

Let us know if that helped move you forward!

ps I gave this a quick try and this seems to be working:

FROM resin/%%RESIN_MACHINE_NAME%%-python

RUN apt-get update && apt-get install -yq wiringpi git

WORKDIR /usr/src/app

RUN git clone https://github.com/alexburcea2877/megaio-rpi.git
CMD cd megaio-rpi && make install && cd .. && rm -rf megaio-rpi

COPY . ./


CMD ["python","src/main.py"]

(I created a dummy src/main.py that just sleeps to infinity, your code would go there obv:)

Thank you so much! Yeah, I’ll definitely use that! The support on this platform is amazing. Thank you.

Only one more issue. The GPIO command works perfectly however the megaio command does not?

Hey @tate it’s now Sat night quite late here so I’m signing off until Monday.

in the meantime I’d recommend ssh’ing into the application container (either via the dashboard or resin CLI) and checking if the megoaio files have been successfully installed, and if there’s any additional information in any log files.

Let me know if you were able to fix things or if there’s any extra information you were able to find for Monday

Sure, no worries.

I figured out that the megaio repository was successfully cloned into the project, but the make install command did not work on the dockerfile. The odd thing is that I was just able to cd into the repository root and type make install successfully.

I’m going to see if I can find out what’s happening tomorrow.

Hey, I’ve been trying to fix this for a couple days now and I’m still totally stumped. I actually have no idea what to do at this point! Feel free to respond if you find anything.

Hi @tate there’s a few things in the Dockerfile.template that stand out at first glance, but let me take a deeper look before diving in to see if I can get it working end to end here (as far as I can without having the actual hardware that is).

I’ll get back to you later today

@tate you were SO close! Here’s a working Dockerfile.template:

FROM resin/%%RESIN_MACHINE_NAME%%-python

# Installing WiringPi Library Package
RUN apt-get update && apt-get install -yq wiringpi git

# Setting working directory
WORKDIR /usr/src/app

# Building and installing Mega-io Repository
RUN cd /usr/src/app && git clone https://github.com/alexburcea2877/megaio-rpi.git
RUN cd /usr/src/app/megaio-rpi && make install

COPY ./requirements.txt /requirements.txt
# Gotta get those requirements
# RUN pip install -r /requirements.txt
COPY . ./

# Initializing system

# Running initial script
CMD ["python","main.py"]

There were a few small issues, in one place you used a CMD instead of a RUN, the make install wasn’t actually executed in the wiringPi directory, and there was a small formatting problem with the CMD command. With those fixed it now seems to run well for me, save the mega IO not found message, which is expected :slight_smile:

02.05.18 12:05:46 (+0100) Started service 'main sha256:9e4d3b8e410b7af0396153d7479c725f0493711c019c529dd690c8ee46bc1f90'
02.05.18 12:05:46 (+0100)  main  Systemd init system enabled.
02.05.18 12:05:46 (+0100)  main  systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
02.05.18 12:05:46 (+0100)  main  Detected virtualization 'other'.
02.05.18 12:05:46 (+0100)  main  Detected architecture 'arm'.
02.05.18 12:05:46 (+0100)  main  Set hostname to <f18e9a5>.
02.05.18 12:05:59 (+0100)  main  MegaIO id 0 not detected
02.05.18 12:05:59 (+0100)  main  NOW WATERING THE PLANTS
02.05.18 12:06:11 (+0100)  main  MegaIO id 0 not detected
02.05.18 12:06:11 (+0100)  main  JUST FINISHED WATERING THE PLANTS
02.05.18 12:06:21 (+0100)  main  MegaIO id 0 not detected

Let me know if that works for you!

Awesome thanks! I’ll check it out later today

Worked perfectly. Thanks again

So glad to hear that @tate! Let us know if you have some photos, blogpost or tweet to share once this is up and running :slight_smile:

awesome, will do!