A Comprehensive Guide to Nanobox CLI Commands

Nanobox CLI Commands Techhyme

Nanobox is a powerful development platform that simplifies the process of deploying, managing, and scaling applications. It provides a user-friendly Command-Line Interface (CLI) that enables developers to interact with their applications and environments efficiently.

In this guide, we will explore the various Nanobox CLI commands and how they can be used to streamline your development workflow.

  1. Update and Basic Commands
    1. Update Nanobox CLI
    2. Start Local Environment
    3. Build App’s Runtime
    4. Compile App’s Code
  2. Managing Connections and Deployments
    1. Manage Remote Connections
    2. Deploy Your App
  3. Interacting with Live Apps
    1. Open Interactive Terminal
    2. App Information and Logs
    3. Secure Tunnel
  4. Environment Variables and DNS Management
    1. Manage Environment Variables
    2. Manage DNS Aliases for Local Applications
  5. Configuration and Cleanup
    1. Configure Nanobox
    2. Clean and Destroy
  6. Miscellaneous Commands
    1. Other Useful Commands
    2. Help and Debug

Update and Basic Commands

1. Update Nanobox CLI:


This command updates your Nanobox CLI to the most recent version, ensuring you have access to the latest features and bug fixes.

2. Start Local Environment:

nanobox run [<command>]

The `run` command starts your local environment and allows you to run your application. You can also specify a command to run within the environment.

3. Build App’s Runtime:

nanobox build

Use this command to build your application’s runtime, which prepares it for deployment.

4. Compile App’s Code:

nanobox compile

The `compile` command compiles your application’s code into a deployable package.

Managing Connections and Deployments

5. Manage Remote Connections:

nanobox remote add <app-name> [<remote-alias>]
nanobox remote rm <remote-alias>
nanobox remote ls

These commands manage connections to remote applications. You can add, remove, and list remote connections.

6. Deploy Your App:

nanobox deploy [<dry-run | {remote-alias}>] [-m <message>]

The `deploy` command allows you to deploy your application to a live environment. You can specify a dry-run or a specific remote alias and include an optional deployment message.

Interacting with Live Apps

7. Open Interactive Terminal:

nanobox console [<local | dry-run | {remote-alias}>] <component.id>

Use the `console` command to open an interactive terminal from inside a component in your live application.

8. App Information and Logs:

nanobox info [<local | dry-run | {remote-alias}>]
nanobox log [<dry-run | {remote-alias}>]

The `info` command displays information about the app and its components, while the `log` command allows you to view and stream application logs.

9. Secure Tunnel:

nanobox tunnel [<remote-alias>] <component.id> [-p <local-port>[:[<remote-port>]]]

The `tunnel` command establishes a secure tunnel from your local machine to a running service, enabling secure access to specific components.

Environment Variables and DNS Management

10. Manage Environment Variables:

nanobox evar add [<local | dry-run | {remote-alias}>] <key1>=<value1> <key2>=<value2>
nanobox evar load [<local | dry-run | {remote-alias}>] path/to/file
nanobox evar rm [<local | dry-run | {remote-alias}>] <key1> <key2>
nanobox evar ls [<local | dry-run | {remote-alias}>]

These commands allow you to manage environment variables on your production environment.

11. Manage DNS Aliases for Local Applications:

nanobox dns add <local | dry-run> <hostname>
nanobox dns rm <local | dry-run> <hostname>
nanobox dns ls <local | dry-run>

The `dns` commands let you manage DNS aliases for local applications.

Configuration and Cleanup

12. Configure Nanobox:

nanobox config set <config-key> <config-value>
nanobox config get <config-key>
nanobox config ls

Use these commands to configure Nanobox settings according to your requirements.

13. Clean and Destroy:

nanobox clean
nanobox destroy [<local | dry-run>]

The `clean` command removes any environments that no longer exist, while `destroy` removes the current project from Nanobox.

Miscellaneous Commands

14. Other Useful Commands:

nanobox start
nanobox stop
nanobox status
nanobox implode
nanobox version

These commands handle starting, stopping, and checking the status of Nanobox and its apps. The `implode` command removes all Nanobox-created containers, files, and data.

15. Help and Debug:

-t, --trace
-v, --verbose
-f, --force

These options provide help information, debug context, and increase display output levels for debugging purposes.

The Nanobox CLI offers a comprehensive set of commands that facilitate the development and deployment of applications. By leveraging these commands, developers can efficiently manage their environments, access logs, and seamlessly deploy their apps to production. Nanobox empowers developers to focus on coding, while it handles the complexities of the deployment process.

Happy coding with Nanobox!

Related Posts

Leave a Reply