Your first sandbox
Create a sandbox, run a command, and remove it with the carton CLI.
Start here after installation and connection setup.
Replace IMAGE in the command below with an image reference prepared for
your configured provider. Choose another sandbox name if hello already
exists.
Create a sandbox
carton create IMAGE --name hello
Carton uses the default route from your configuration to choose a provider. The CLI waits up to 60 seconds for readiness. Confirm the sandbox is ready before running your command.
Run a command
carton exec hello -- echo "Hello from carton"
You should see Hello from carton in your terminal. The CLI forwards the
command’s output and exit status.
Arguments after -- go to the sandbox command. For shell syntax such as
pipes or redirection, invoke a shell:
carton exec hello -- sh -c 'echo hello > /tmp/hello.txt'
Copy a file
carton cp hello:/tmp/hello.txt ./hello-from-carton.txt
Choose another destination if that local file already exists. You can copy in the other direction by putting the local path first.
Inspect and clean up
carton ls
carton destroy hello
Destroy the sandbox when you finish to avoid leaving provider resources running. Your downloaded file stays on your machine.
For the programmatic version of this lifecycle, see the SDK preview. For provider-specific setup, see Providers.