The official balena CLI tool.
Go to file
Kyle Harding 9036ce9af3 docker: Improve handling of Docker-in-Docker errors
The `local` logging driver captures output from container’s stdout/stderr
and writes them to an internal storage that is optimized for performance and disk use.

We also want to capture these logs on startup to wait for success/failure.

Advise the use of `--privileged` when running Docker-in-Docker to avoid
various permissions issues encountered in testing.

Change-type: patch
Changlelog-entry: docker: Improve handling of Docker-in-Docker errors
Signed-off-by: Kyle Harding <kyle@balena.io>
2021-03-25 14:02:22 +00:00
.github Revert styling of "balena CLI" as "balenaCLI" 2020-10-21 00:07:46 +01:00
.versionbot v12.43.1 2021-03-26 01:15:19 +02:00
automation Refactor automation scripts (reduce need for MSYS to build on Windows) 2021-03-23 00:04:43 +00:00
bin Modify handling of SIGINT in balena-dev 2020-12-18 10:19:55 +01:00
doc Add macOS uninstall script (sudo /usr/local/lib/balena-cli/bin/uninstall) 2021-03-23 00:04:43 +00:00
docker docker: Improve handling of Docker-in-Docker errors 2021-03-25 14:02:22 +00:00
lib push: Fix docker-compose.dev.yml serialization ("should be object,null" error) 2021-03-20 22:17:20 +00:00
patches Add macOS uninstall script (sudo /usr/local/lib/balena-cli/bin/uninstall) 2021-03-23 00:04:43 +00:00
tests Bump patch-package dependency and remove its own patch file 2021-03-22 16:12:44 +00:00
typings scan: Print production devices' info on scan 2020-12-01 13:31:29 +02:00
.dockerignore docker: Add Docker images with the CLI and Docker-in-Docker 2021-03-15 08:34:23 -04:00
.editorconfig fix resin local push help message and lint errors 2017-03-21 12:06:05 +03:00
.gitattributes Allow rebasing of npm-shrinkwrap 2020-08-12 14:46:51 +01:00
.gitignore docker: Add Docker images with the CLI and Docker-in-Docker 2021-03-15 08:34:23 -04:00
.hound.yml Convert gulpfile.coffee to javascript 2020-04-30 17:58:13 +01:00
.mocharc-standalone.js Test code optimization: avoid running ~70 test cases twice 2020-11-15 23:36:58 +00:00
.mocharc.js Test code optimization: avoid running ~70 test cases twice 2020-11-15 23:36:58 +00:00
.prettierrc Fix prettier configuration to avoid linting errors 2018-03-05 16:02:09 +01:00
.resinci.yml docker: Add Docker images with the CLI and Docker-in-Docker 2021-03-15 08:34:23 -04:00
balena-completion.bash Remove 'signup' command 2019-06-04 17:06:46 +01:00
CHANGELOG.md v12.43.1 2021-03-26 01:15:19 +02:00
CONTRIBUTING.md Add macOS uninstall script (sudo /usr/local/lib/balena-cli/bin/uninstall) 2021-03-23 00:04:43 +00:00
gulpfile.js Convert gulpfile.coffee to javascript 2020-04-30 17:58:13 +01:00
INSTALL-ADVANCED.md Add macOS uninstall script (sudo /usr/local/lib/balena-cli/bin/uninstall) 2021-03-23 00:04:43 +00:00
INSTALL-LINUX.md Linux installation instructions: Add sudo configuration section 2021-03-07 23:31:31 +00:00
INSTALL-MAC.md Improve installation docs regarding Docker Desktop version requirements 2021-03-25 16:07:09 +00:00
INSTALL-WINDOWS.md Improve installation docs regarding Docker Desktop version requirements 2021-03-25 16:07:09 +00:00
INSTALL.md Revert styling of "balena CLI" as "balenaCLI" 2020-10-21 00:07:46 +01:00
LICENSE Change license to Apache 2.0 2016-01-03 23:58:51 -04:00
npm-shrinkwrap.json v12.43.1 2021-03-26 01:15:19 +02:00
package.json v12.43.1 2021-03-26 01:15:19 +02:00
README.md Add macOS uninstall script (sudo /usr/local/lib/balena-cli/bin/uninstall) 2021-03-23 00:04:43 +00:00
repo.yml Update balena-sdk to 15.x 2020-08-11 17:53:33 +01:00
TROUBLESHOOTING.md Revert styling of "balena CLI" as "balenaCLI" 2020-10-21 00:07:46 +01:00
tsconfig.dev.json Add ability to conditionally apply patches per platform (Linux, Mac, Windows) 2020-07-15 16:30:15 +00:00
tsconfig.js.json Use balena-lint for javascript linting and add javascript type-checking 2020-03-25 12:12:03 +00:00
tsconfig.json Be lazier with imports in oclif actions 2020-07-09 15:03:38 +01:00
tslint.json Enforce and improve lazy loading of resin-cli-form 2020-07-09 10:51:10 +01:00

balena CLI

The official balena Command Line Interface.

npm version dependencies

About

The balena CLI is a Command Line Interface for balenaCloud or openBalena. It is a software tool available for Windows, macOS and Linux, used through a command prompt / terminal window. It can be used interactively or invoked in scripts. The balena CLI builds on the balena API and the balena SDK, and can also be directly imported in Node.js applications. The balena CLI is an open-source project on GitHub, and your contribution is also welcome!

Installation

Check the balena CLI installation instructions on GitHub.

Choosing a shell (command prompt/terminal)

On Windows, the standard Command Prompt (cmd.exe) and PowerShell are supported. Alternative shells include:

  • MSYS2:

  • MSYS

  • Git for Windows

    • During the installation, you will be prompted to choose between "Use MinTTY" and "Use Windows' default console window". Choose the latter, because of the same MSYS2 bug mentioned above (Git for Windows actually uses MSYS2). For a screenshot, check this comment.
  • Microsoft's Windows Subsystem for Linux (WSL). In this case, a Linux distribution like Ubuntu is installed via the Microsoft Store, and a balena CLI release for Linux should be selected. See FAQ for using the balena CLI with WSL and Docker Desktop for Windows.

On macOS and Linux, the standard terminal window is supported. Optionally, bash command auto completion may be enabled by copying the balena-completion.bash file to your system's bash_completion directory: check Docker's command completion guide for system setup instructions.

Logging in

Several CLI commands require access to your balenaCloud account, for example in order to push a new release to your application. Those commands require creating a CLI login session by running:

$ balena login

Proxy support

HTTP(S) proxies can be configured through any of the following methods, in precedence order (from higher to lower):

  • The BALENARC_PROXY environment variable in URL format, with protocol (http or https), host, port and optionally basic auth. Examples:

    • export BALENARC_PROXY='https://bob:secret@proxy.company.com:12345'
    • export BALENARC_PROXY='http://localhost:8000'
  • The proxy setting in the CLI config file. It may be:

    • A string in URL format, e.g. proxy: 'http://localhost:8000'
    • An object in the format:
      proxy:
          protocol: 'http'
          host: 'proxy.company.com'
          port: 12345
          proxyAuth: 'bob:secret'
      
  • The HTTPS_PROXY and/or HTTP_PROXY environment variables, in the same URL format as BALENARC_PROXY.

Proxy setup for balena ssh

In order to work behind a proxy server, the balena ssh command requires the proxytunnel package (command-line tool) to be installed. proxytunnel is available for Linux distributions like Ubuntu/Debian (apt install proxytunnel), and for macOS through Homebrew. Windows support is limited to the Windows Subsystem for Linux (e.g., by installing Ubuntu through the Microsoft App Store).

Ensure that the proxy server is configured to allow proxy requests to ssh port 22, using SSL encryption. For example, in the case of the Squid proxy server, it should be configured with the following rules in the squid.conf file:
acl SSL_ports port 22
acl Safe_ports port 22

Proxy exclusion

The BALENARC_NO_PROXY variable may be used to exclude specified destinations from proxying.

  • This feature requires CLI version 11.30.8 or later. In the case of the npm installation option, it also requires Node.js version 10.16.0 or later.
  • To exclude a balena ssh target from proxying (IP address or .local hostname), the --noproxy option should be specified in addition to the BALENARC_NO_PROXY variable.

By default (if BALENARC_NO_PROXY is not defined), all private IPv4 addresses and '*.local' hostnames are excluded from proxying. Other hostnames that resolve to private IPv4 addresses are not excluded by default, because matching takes place before name resolution.

localhost and 127.0.0.1 are always excluded from proxying, regardless of the value of BALENARC_NO_PROXY.

The format of the BALENARC_NO_PROXY environment variable is a comma-separated list of patterns that are matched against hostnames or IP addresses. For example:

export BALENARC_NO_PROXY='*.local,dev*.mycompany.com,192.168.*'

Matched patterns are excluded from proxying. Wildcard expressions are documented at matcher. Matching takes place before name resolution, so a pattern like '192.168.*' will not match a hostname that resolves to an IP address like 192.168.1.2.

Command reference documentation

The full CLI command reference is available on the web or by running balena help --verbose.

Support, FAQ and troubleshooting

To learn more, troubleshoot issues, or to contact us for support:

For CLI bug reports or feature requests, check the CLI GitHub issues.

Deprecation policy

The balena CLI uses semver versioning, with the concepts of major, minor and patch version releases.

The latest release of a major version of the balena CLI will remain compatible with the balenaCloud backend services for at least one year from the date when the following major version is released. For example, balena CLI v10.17.5, as the latest v10 release, would remain compatible with the balenaCloud backend for one year from the date when v11.0.0 is released.

At the end of this period, the older major version is considered deprecated and some of the functionality that depends on balenaCloud services may stop working at any time. Users are encouraged to regularly update the balena CLI to the latest version.

Contributing (including editing documentation files)

Please have a look at the CONTRIBUTING.md file for some guidance before submitting a pull request or updating documentation (because some files are automatically generated). Thank you for your help and interest!

License

The project is licensed under the Apache 2.0 License. A copy is also available in the LICENSE file in this repository.