Local mode: "The command '/bin/sh -c apk update && apk add bash jq' returned a non-zero code: 139"


I’m following through the getting started guide for Node.js on RPi.

Pushing to balenaCloud works fine – the simple-server-node app runs on the device.

But enabling local mode and doing a balena push <ip> from the simple-server-node directory, not so much:

$ balena push
[debug] original argv0="/usr/local/lib/balena-cli/bin/node" argv=[/usr/local/lib/balena-cli/bin/node,/usr/local/lib/balena-cli/bin/run,push,] length=4
[debug] Using . as build source
[Debug]   Checking we can access device
[Debug]   Sending request to
[Debug]   Checking device version: 9.14.0
[Info]    Starting build on device
[Debug]   Loading project...
[Debug]   Resolving project...
[Debug]   Failed to resolve project:
[Debug]   AggregateError of:
[Debug]       Error: ENOENT: no such file or directory, open 'docker-compose.yml'
[Debug]       Error: ENOENT: no such file or directory, open 'docker-compose.yaml'
[Info]    Creating default composition with source: .
[Debug]   Creating project...
[Debug]   Tarring all non-ignored files...
[Debug]   Sending request to
[Debug]   Found build tasks:
[Debug]       main: build [.]
[Debug]   Resolving services with [raspberry-pi|rpi]
[Debug]   Found project types:
[Debug]       main: Dockerfile.template
[Debug]   Probing remote daemon for cache images
[Debug]   Using 6 on-device images for cache...
[Debug]   Starting builds...
[Build]   [main] Step 1/8 : FROM balenalib/raspberry-pi-node:10-stretch-run
[Build]   [main]  ---> 1def9448c64f
[Build]   [main] Step 2/8 : WORKDIR /usr/src/app
[Build]   [main]  ---> Using cache
[Build]   [main]  ---> c04250a85461
[Build]   [main] Step 3/8 : COPY package.json package.json
[Build]   [main]  ---> Using cache
[Build]   [main]  ---> 8a6125c189bd
[Build]   [main] Step 4/8 : RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*
[Build]   [main]  ---> Using cache
[Build]   [main]  ---> 769314d83375
[Build]   [main] Step 5/8 : COPY . ./
[Build]   [main]  ---> Using cache
[Build]   [main]  ---> a6046d4396ff
[Build]   [main] Step 6/8 : ENV UDEV=1
[Build]   [main]  ---> Using cache
[Build]   [main]  ---> 67bd83e1c222
[Build]   [main] Step 7/8 : CMD ["npm", "start"]
[Build]   [main]  ---> Using cache
[Build]   [main]  ---> 613579ac935a
[Build]   [main] Step 8/8 : LABEL "io.resin.local.image"='1' "io.resin.local.service"='main'
[Build]   [main]  ---> Using cache
[Build]   [main]  ---> 3dde7641d8ea
[Build]   [main] Successfully built 3dde7641d8ea
[Build]   [main] Successfully tagged local_image_main:latest
SecretRemovalError: The command '/bin/sh -c apk update && apk add bash jq' returned a non-zero code: 139
    at Object.<anonymous> (/usr/local/lib/balena-cli/node_modules/resin-multibuild/build/index.js:124:19)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/balena-cli/node_modules/resin-multibuild/build/index.js:5:65)

I haven’t dug deeper into this as running off balenaCloud is plenty fun enough for now… but, any ideas?


Hi and welcome to the forums!

Which version of the CLI are you using?
Kinda redundant question given the error: are you running the balena push ... command from the directory where the docker-compose.yml file is?

That was fast!

I’m on 11.11.2.

I’m running directly from an unmodified clone of the getting started repo at https://github.com/balena-io-projects/simple-server-node, so no docker-compose.yml present. But I am running balena push ... from the repo directory, yes.

Could docker-compose.yml be what’s missing to get the app running in local mode? I wasn’t intending to run multi-container just yet…

It could, but with it being a single-container app I’m not sure what the issue is here, the docker-compose file should be used only for multi-container applications (of which there’s an example too in the guide you’re following, if you want to give it a try).
We’ll dig more into it and let you know!

Thank you – I appreciate the help. Once I’m bored of playing around with the ridiculously fun balenaCloud stuff (really - this is all amazing) I’ll circle back to dig in my end.

Thanks again!

Hey, so that error that’s being pointed out is actually slightly misleading, and only shown because debug mode is enabled. It’s basically saying it looked for a docker-compose file and did not find one, therefore will fall back to a single container build. The error that you’re seeing looks to be related to the secrets subsystem that runs within builds. Could you confirm your balena-cli version please? And also please check if you have a .balena directory in your project directory.

Hey Cameron,

Thanks for the reply. I’m on cli version 11.11.2. There’s no .balena directory in the project directory (which was git cloned from https://github.com/balena-io-projects/simple-server-node).

I’m following this guide verbatim: https://www.balena.io/docs/learn/getting-started/raspberrypi3/nodejs/ which has worked great with the Balena Cloud build, just not yet with local mode.

The device is on balenaOS version 2.32.0+rev1 (development), it’s an RPi Zero and I had enabled local mode in the dashboard first.


We’ve identified a problem in the way that secrets are populated (and removed) for builds. Your issue also raised another point, which is there is no need to run the removal of secrets if a build is not using them. To move forward, we plan to first stop the CLI from running any secret related code if there are no secrets as part of this build. Secondly, we are moving to a system in which the population and removal of the secrets require no more processing (e.g. that error shouldn’t occur, because that dockerfile step won’t occur). We have the following issue to track this: https://github.com/balena-io/balena-cli/issues/1355

Thanks for the report!

Brilliant, thanks! Slightly relieved I wasn’t being totally stupid. Otherwise, though, it’s been a total joy to get up and running, both with balenaCloud and openBalena.

Thanks again. We will update this thread once the issue is resolved.