CLI Commands
Build your sandbox with our CLI.
You can use --help
flag for more information about commands.
Auth
auth login
Log in to the CLI. It will save your access token in ~/.e2b
file.
e2b auth login
auth logout
Log out of the CLI. It will remove your access token from ~/.e2b
file.
e2b auth logout
auth configure
Configure the default team for the CLI. It will be used for all commands that require a team.
e2b auth configure
auth info
Get info about your current user.
e2b auth info
Templates
template init
Creates a basic Dockerfile (./e2b.Dockerfile
) in current directory.
You can then run e2b template build
to build sandbox template from this Dockerfile.
e2b template init
Options
- Name
- Flags
- -p, --path
path
- Description
Change the root directory where the command is executed to
path
directory.
template build
Builds a sandbox template defined by ./e2b.Dockerfile
or ./Dockerfile
from the root directory.
By default, the root directory is the current working directory.
This command also creates the e2b.toml
config.
e2b template build
Running e2b template build
without specifying a template with the [template]
argument will rebuild template defined by the e2b.toml
config.
If there is no e2b.toml
config a new template will be created.
Arguments
- Name
- Flags
- [template]
- Description
Specify the template you want to rebuild. You can use the template name or ID.
Options
- Name
- Flags
- -c, --cmd
start-command
- Description
Specify the command that should be running when a sandbox starts.
- Name
- Flags
- --config
e2b-toml
- Description
Specify the path to the config file. By default, E2B tries to find
e2b.toml
in the root directory.
- Name
- Flags
- -n, --name
template-name
- Description
Specify the name of the sandbox template. You can use the template name to start the sandbox in the SDK. The name must be lowercase and contain only letters, numbers, dashes, and underscores.
- Name
- Flags
- -p, --path
path
- Description
Change the root directory where the command is executed to the
path
directory.
- Name
- Flags
- -d, --dockerfile
dockerfile
- Description
Specify the path to Dockerfile. By default E2B tries to find
e2b.Dockerfile
orDockerfile
in the root directory.
- Name
- Flags
- -t, --team
team
- Description
Specify the team that will be used for the sandbox template. You can find team ID in the team settings in the E2B dashboard.
- Name
- Flags
- --cpu-count
cpu-count
- Description
Specify the number of CPUs that will be used to run the sandbox. The default value is 2.
- Name
- Flags
- --memory-mb
memory-mb
- Description
Specify the amount of memory in megabytes that will be used to run the sandbox. Must be an even number. The default value is 512.
- Name
- Flags
- --build-arg
build-arg
- Description
Specify a build argument for the Dockerfile. The format is
key=value
. You can use this option multiple times.
template delete
Delete the sandbox template specified by the [template]
argument, e2b.toml
config in the working directory, or by an interactive selection.
By default, the root directory is the current working directory.
This command also deletes the e2b.toml
config.
e2b template delete
Running e2b template delete
without specifying a template with the [template]
argument will delete the template defined by the e2b.toml
config.
Arguments
- Name
- Flags
- [template]
- Description
Specify the template you want to delete. You can use the template name or ID.
Options
- Name
- Flags
- -p, --path
path
- Description
Change the root directory where the command is executed to the
path
directory.
- Name
- Flags
- --config
e2b-toml
- Description
Specify the path to the config file. By default, E2B tries to find
e2b.toml
in the root directory.
- Name
- Flags
- -s, --select
- Description
Interactively select sandbox templates you want to delete.
- Name
- Flags
- -y, --yes
- Description
Don't ask for confirmation before deleting the sandbox template.
- Name
- Flags
- -t, --team
team
- Description
Specify the team that will be used for the sandbox template. You can find team ID in the team settings in the E2B dashboard.
template list
List your sandbox templates.
e2b template list
Options
- Name
- Flags
- -t, --team
team
- Description
Specify the team that will be used for the sandbox template. You can find team ID in the team settings in the E2B dashboard.
Sandboxes
sandbox list
List your spawned sandboxes that are running right now.
e2b sandbox list
sandbox logs
Starts printing logs from the specified sandbox. If the sandbox is running new logs will be streamed to the terminal.
The timestamps are in the UTC format.
This command is useful if you need to debug a running sandbox or check logs from a sandbox that was already closed.
e2b sandbox logs <sandboxID>
You can use e2b sandbox list
to get a list of running sandboxes and their IDs that can be used with e2b sandbox logs <sandboxID>
command.
Arguments
- Name
- Flags
- <sandboxID>
- Description
Specify the ID of the sandbox you want to get logs from.
Options
- Name
- Flags
- --level
level
- Description
Filter logs by level — allowed values are
DEBUG
,INFO
,WARN
,ERROR
. The logs with the higher levels will be also shown.Default value is
DEBUG
.
- Name
- Flags
- -f, --follow
- Description
Enable streaming logs until the sandbox is closed.
- Name
- Flags
- --format
format
- Description
Specify format for printing logs — allowed values are
pretty
,json
.Default value is
pretty
.
- Name
- Flags
- --loggers
loggers
- Description
Specify enabled loggers — allowed values are
process
,filesystem
,terminal
,network
andfile
. You can specify multiple loggers by separating them with a comma.Default value is
process,filesystem
.
sandbox connect
Connects your terminal to a running sandbox that you spawned via the E2B SDK. This command is useful if you need to debug a running sandbox.
This command works similar to the docker exec -it <container> bash
command in Docker.
e2b sandbox connect <sandboxID>
You can use e2b sandbox list
to get a list of running sandboxes and their IDs that can be used with e2b sandbox connect <sandboxID>
command.
Arguments
- Name
- Flags
- <sandboxID>
- Description
Specify the ID of a running sandbox you want to connect to.
sandbox spawn
Spawns a sandbox and connects your terminal to the sandbox. This command can be used to debug your sandbox template.
This command works similar to the docker run -it <image> bash
command in Docker.
e2b sandbox spawn
Running e2b sandbox spawn
without specifying a template with the [template]
argument will spawn sandbox defined by the e2b.toml
config.
Arguments
- Name
- Flags
- [template]
- Description
Specify the template you want to spawn sandbox from. You can use the template name or ID.
Options
- Name
- Flags
- -p, --path
path
- Description
Change the root directory where the command is executed to
path
directory.
- Name
- Flags
- --config
e2b-toml
- Description
Specify the path to the config file. By default, E2B tries to find
e2b.toml
in the root directory.
sandbox kill
Immediately kill a running sandbox.
e2b sandbox kill <sandboxID>