Adding new applications to /usr/local/bin

#1

I am running a Balena base image: https://github.com/balena-io-library/base-images/blob/master/balena-base-images/python/raspberrypi3/ubuntu/xenial/3.6.8/build/Dockerfile, and it works fine, but what I really need is to understand how I could run an executable such as http://www.aishub.net/ais-dispatcher.

Each time I added it to the Docker as I would in any other container (as in download it, move it to /usr/local/bin with chmod +x and expect it to be launchable from bash) it reports it does not exist, or cannot be run.

Does anyone have experience on how to accomplish this on balena? I have an inkling that its something super minor I am missing here since it does work on the same Linux distro outside balena. :frowning:

Similarly, I would expect to run this app with all of its command line parameters using CMD.

This is what I have so far:

# Download/Unarchive/Move AisHub Dispatcher
RUN wget -O aisdispatcher_linux.tar.gz http://www.aishub.net/downloads/aisdispatcher_arm_glibc.tar.gz \
	&& tar -xzf aisdispatcher_linux.tar.gz && rm aisdispatcher_linux.tar.gz \
	&& mkdir /app \
	&& mv aisdispatcher_arm_glibc/aisdispatcher /app \
	&& chmod +x /app/aisdispatcher

# CMD ["/app/aisdispatcher","-r", "-d", "/dev/ttyS0", "-s", "38400", "-H", "data.aishub.net:2300", "-G"]
#4

Hi @trappswise welcome to the forums!

I’ve just run your app on one of my own devices. It looks like the issue is that you are using invalid double-quote characters in your CMD. You’ll need to use straight/ASCII double quotes, but some of the ones you pasted are typographic ‘66’ ‘99’ style ones.

Here’s the Dockerfile I used which started the app fine:

FROM balenalib/raspberrypi3

RUN curl -o aisdispatcher_linux.tar.gz 
http://www.aishub.net/downloads/aisdispatcher_arm_glibc.tar.gz \
&& tar -xzf aisdispatcher_linux.tar.gz && rm aisdispatcher_linux.tar.gz \
&& mkdir /app \
&& mv aisdispatcher_arm_glibc/aisdispatcher /app \
&& chmod +x /app/aisdispatcher

CMD ["/app/aisdispatcher","-r","-d", "/dev/ttyS0", "-s", "38400", "-H", "data.aishub.net:2300", "-G"]

I hope this helps!

#5

Thank you for your reply. I have checked, and in the version I posted this was indeed the issue, and it is now resolved. However, we still have a problem such that when we successfully execute CMD command on “/app/aisdispatcher”, which was created in the previous layer, it claims that: " No such file or directory". Do we need to take some extra steps to have the file persist between the CMD command and the commands above it?

#6

@trappswise did you try the Dockerfile that I posted above? This one starts the app fine.

#7

@trappswise did you resolve your issue here? If you need any further help let us know in this thread; my colleague shared an email of yours with me but I am not sure if you’ve got past that issue yet.

#8

Yes. The problem was indeed solved! Thank you!

1 Like