How to write a Dockerfile for a Crank container

I have a Storyboard app that will run in simulation and on an NXP 1050 with FreeRTOS. I’m now trying to build the same application and run it in a container on a Toradex iMX6 SoM. The image builds and I can start a container from the image. But it then immediately exits without ever displaying the app on the touchscreen I have attached.

Here is the command and the output:

apalis-imx6-10657251:~/crank/scp/export$ docker run -it --privileged -p 55555:55555 -v /home/torizon/crank/scp:/usr/crank/scp -v /dev:/dev -v /tmp:/tmp embeddedkyle/crank_it:1.0
/usr/crank/scp/export/crank/apps/Crank_IT/Crank_IT-rz.gapp
Starting Storyboard SCP Application...
/usr/crank/runtimes/linux-imx6yocto-armle-opengles_2.0-wayland-obj/bin/sbengine -orender_mgr,fullscreen -omtdev,device=/dev/input/event1 /usr/crank/scp/export/crank/apps/Crank_IT/Crank_IT-rz.gapp

I’m following the guide located here

I had to make some modifications for the iMX6 versus iMX8. I’ve attached the Dockerfile and script here

Please let me know what else you need from me. Thanks.

Greetings @embedded.kyle,

You mentioned you’re trying to run this on a touch screen you have attached. Could you specify what kind of touchscreen? Also have you seen output on this touchscreen with Torizon prior to running this Crank container?

Also could you perhaps provide the logs from the container if possible?

Best Regards,
Jeremias

Touchscreen is the Toradex 7" Capacitive. I currently have Torizon/Portainer running on it. I have run the Crank Demo container on it and that worked except the resolution was too large.

apalis-imx6-10657251:~/crank/scp/export$ docker logs --details awesome_gagarin
IMAGE_NAME=embeddedkyle%2Fcrank_it%3A1.0 /usr/crank/scp/export/crank/apps/Crank_IT/Crank_IT-rz.gapp
IMAGE_NAME=embeddedkyle%2Fcrank_it%3A1.0 Starting Storyboard SCP Application...
IMAGE_NAME=embeddedkyle%2Fcrank_it%3A1.0 /usr/crank/runtimes/linux-imx6yocto-armle-opengles_2.0-wayland-obj/bin/sbengine -i -vvv -orender_mgr,fullscreen -omtdev,device=/dev/input/event1 /usr/crank/scp/export/crank/apps/Crank_IT/Crank_IT-rz.gapp

Actually one quick thought I had looking at your setup. Are you only running this one container? Looking at your Dockefile this provides a wayland client but it needs a weston container to go along with it. This is similar to how the Crank Demo container works.

Try first running the weston container as with the Demo container:

docker run -d -it --restart=always --privileged -v /tmp:/tmp -v /run/udev/:/run/udev torizon/arm32v7-debian-weston:buster weston-launch --tty=/dev/tty7 --user=root

Then try running your custom Crank container.

Best Regards,
Jeremias

I’m trying to add it to the default stack that includes 3 containers, weston, kiosk, and portainer. The Crank demo seemed to work just fine with all 3 running. I just shut down kiosk and portainer then ran my Crank container. Same result.

In this case it might be a Crank related issue perhaps? (i.e. application or their container specifics). Then again I believe the Dockerfile structure is similar to what was used to build the Demo container so perhaps the application is not starting correctly? It’s hard to tell since the logs don’t show any explicit errors.

Have you tried the sample with other sample Crank applications than this one? Also is your application container available on Dockerhub? It would help if I could pull the same container down to reproduce/debug on my side.

Best Regards,
Jeremias

You gave me a good idea and I feel dumb for not trying it before. The script will run a .gapp if it’s in the scp directory. Otherwise, it will run the demo. So I deployed my .gapp to the directory and loaded up the demo container. The app displays and the touch interface works. So no issues there, the app I built is fully functional on the device and in a container.

I’ve uploaded my image to Dockerhub for you to take a look. Let me know if you see anything off about it. Thanks.

embeddedkyle/crank_it

Just so I understand you’re saying you transplanted your custom crank application into the Demo crank container and that worked, correct? But the same custom application doesn’t work in your own container you built?

Also when I ran your container I got the following error:

/bin/sh: 1: /usr/crank/docker_sbengine.sh: Permission denied

Perhaps when you built the container you copied this script in with strange/root permissions?

Anyways let me run this by my contacts at Crank and see why there’s a behavior difference between their demo container and the container you’ve built here.

Best Regards,
Jeremias

That is correct. My Crank app works in the Crank Demo container but not in my own container.

I have seen that error as well. It’s being copied from a Windows machine so the permissions can be strange.

chmod +x crank/scp/docker_sbengine.sh

Running that on the host will fix it.

Alright just wanted to update you, I believe I and an FAE at Crank have found the issues with your container. He should be in contact with you shortly to provide the full solution and details.

Best Regards,
Jeremias

Yes I’ve been working jointly with Nik from Crank on your issue behind the scenes.

Glad we were able to resolve this for you.

Best Regards,
Jeremias

I wonder if we’ve been talking to the same FAE. Nik?

Anyways, for posterity, the issue was that I needed the Wayland runtime. They do not ship the Wayland runtime with the normal Crank Storyboard. Just a basic one for iMX6 built with yocto.

But I’ve got it working now. Thanks for taking the time to work through this.