balena deploy app image fails

I am trying to deploy a Docker container with balena deploy app image which used to work but now I get this error:

Version: 11.30.12

$ ~/opt/balena-cli/balena deploy first-nuc 123456789012.dkr.ecr.eu-west-1.amazonaws.com/automation/xxx/yyyv1.0.18-linux-amd64
Error: no "Dockerfile[.*]", "docker-compose.yml" or "package.json" file
found in source folder "."
ExpectedError: Error: no "Dockerfile[.*]", "docker-compose.yml" or "package.json" file
found in source folder "."
    at validateProjectDirectory (/usr/local/Cellar/balena-cli/11.30.6/libexec/lib/node_modules/balena-cli/build/utils/compose_ts.js:256:19)
From previous event:
    at processImmediate (internal/timers.js:456:21)
From previous event:
    at Command.action (/usr/local/Cellar/balena-cli/11.30.6/libexec/lib/node_modules/balena-cli/build/actions/deploy.js:167:8)
    at /usr/local/Cellar/balena-cli/11.30.6/libexec/lib/node_modules/balena-cli/node_modules/capitano/build/command.js:98:37
    at runNextTicks (internal/process/task_queues.js:62:5)
    at processImmediate (internal/timers.js:429:9)
    at process.topLevelDomainCallback (domain.js:137:15)

If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For CLI bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

Maybe you are running this from a different folder (judging from the error message)?

Why would that make a difference? I am trying to deploy an already existing container.

Hi, when you push you need to be in the root of the project directory or provide the --source option . This is because it determines the build context that is sent to the balena builders to be built. If you push from the correct directory that error should disappear.

There is no build context or source. I am pushing an existing docker image from my local docker registry. I’ve already built the container. This worked just fine.

I am not building the container with Balena or pushing the source to Balena.

balena-cli ❯ ./balena deploy --help
Usage: deploy <appName> [image]

Usage: `deploy <appName> ([image] | --build [--source build-dir])`

Use this command to deploy an image or a complete multicontainer project to an
application, optionally building it first. The source images are searched for
(and optionally built) using the docker daemon in your development machine or
balena device. (See also the `balena push` command for the option of building
the image in the balenaCloud build servers.)
...

Got it, I misunderstood. Does the image appear when running docker images on your development machine? There is a nice guide here to using balena build and balena deploy commands https://www.balena.io/docs/learn/more/masterclasses/cli-masterclass/#5-building-and-deploying-an-application-without-the-builder that may also assist.

Also, can you confirm the CLI version you are using and your OS.

Thank you.

macOS 10.15.4
Balena CLI 11.30.12 (11.30.6 had the same error)

Yes, the image is there. This works:

docker run --rm -it 123456789012.dkr.ecr.eu-west-1.amazonaws.com/automation/xxx/yyy:v1.0.18-linux-amd64 /bin/bash

I’ve randomly downloaded 11.25.16 and that works.

Hi, thanks. Yes I was able to reproduce this and our CLI team will investigate further and we’ll update as soon as we know anything. I notice that in the changelog here https://github.com/balena-io/balena-cli/blob/master/CHANGELOG.md#11270---2020-02-17 which is 11.27.0 we added Add project directory validation for balena push / build / deploy commands which seems related.

@magiconair, this issue should be fixed in CLI release 11.30.13. Thank you for reporting it. As Gareth had hinted, what happened is that project directory validation was added in release 11.27.0 for the push/build/deploy commands, but I had forgotten about the case of pre-built images where, as you pointed out, there is no build context or source. The CLI was incorrectly attempting to validate the current working directory as if it was a build context. Release 11.30.13 prevents this. Sorry for the trouble and thank you again for reporting it.

1 Like

Thank you. I’ll soon file the next issue that prevents us from deploying… :frowning: