{"slug":"cli-serverless","title":"CLI: Serverless Containers","description":"Deploy and manage serverless containers using the DanubeData CLI.","section":"CLI","url":"https://docs.danubedata.ro/cli-serverless","markdown_url":"https://docs.danubedata.ro/cli-serverless.md","breadcrumbs":[{"title":"CLI","slug":null},{"title":"Rapids","slug":"cli-serverless"}],"headings":[{"level":1,"title":"CLI: Serverless Containers","id":"cli-serverless-containers"},{"level":2,"title":"Prerequisites","id":"prerequisites"},{"level":2,"title":"Quick start","id":"quick-start"},{"level":2,"title":"Listing containers","id":"listing-containers"},{"level":2,"title":"Creating a container","id":"creating-a-container"},{"level":3,"title":"From a Docker image","id":"from-a-docker-image"},{"level":3,"title":"From a Git repository","id":"from-a-git-repository"},{"level":3,"title":"From a local directory (ZIP upload)","id":"from-a-local-directory-zip-upload"},{"level":3,"title":"Resource profiles","id":"resource-profiles"},{"level":2,"title":"Deploying code","id":"deploying-code"},{"level":3,"title":"Container resolution","id":"container-resolution"},{"level":2,"title":"Viewing container details","id":"viewing-container-details"},{"level":2,"title":"Updating a container","id":"updating-a-container"},{"level":3,"title":"Scaling options","id":"scaling-options"},{"level":2,"title":"Deleting a container","id":"deleting-a-container"},{"level":2,"title":"Deployment history","id":"deployment-history"},{"level":2,"title":"Usage and billing","id":"usage-and-billing"},{"level":2,"title":"Complete workflow example","id":"complete-workflow-example"},{"level":2,"title":"Next steps","id":"next-steps"}],"format":"markdown","word_count":828,"content":"# CLI: Serverless Containers\n\nDeploy and manage serverless containers using the DanubeData CLI.\n\n## Prerequisites\n\n- [DanubeData CLI installed](https://docs.danubedata.ro/cli-overview)\n- Authenticated via `danube login` or `DANUBE_TOKEN`\n\n## Quick start\n\nDeploy a serverless container from a Docker image:\n\n```bash\ndanube rapids create --name my-api --type docker_image --image node --tag 20-alpine --port 3000\n```\n\nOr deploy from a local directory:\n\n```bash\ndanube rapids create --name my-api --type zip_upload --source-type dockerfile\ndanube rapids deploy my-api --dir ./\n```\n\n## Listing containers\n\n```bash\ndanube rapids ls\n```\n\nShows all containers with name, status, resource profile, URL, and creation date.\n\n## Creating a container\n\n```bash\ndanube rapids create\n```\n\nWithout flags, the CLI guides you through interactive prompts. You can also pass flags for non-interactive creation.\n\n### From a Docker image\n\n```bash\ndanube rapids create \\\n  --name my-api \\\n  --type docker_image \\\n  --image node \\\n  --tag 20-alpine \\\n  --profile small \\\n  --port 3000\n```\n\n### From a Git repository\n\n```bash\ndanube rapids create \\\n  --name my-api \\\n  --type git_repository \\\n  --repo https://github.com/username/my-api \\\n  --source-type dockerfile \\\n  --profile small \\\n  --port 8080\n```\n\nBuild methods:\n- `dockerfile` — Uses your project's Dockerfile\n- `buildpack` — Auto-detects runtime (Node.js, Python, Go, Java, Ruby, PHP, .NET, Rust)\n\n### From a local directory (ZIP upload)\n\n```bash\ndanube rapids create \\\n  --name my-api \\\n  --type zip_upload \\\n  --source-type buildpack \\\n  --profile small \\\n  --port 3000\n```\n\nThen deploy your code:\n\n```bash\ndanube rapids deploy my-api --dir ./\n```\n\n### Resource profiles\n\n| Profile | vCPU | Memory |\n|---------|------|--------|\n| `free` | 0.01-0.1 | 64-128 MB |\n| `micro` | 0.1-1 | 256-512 MB |\n| `small` | 0.5-1 | 256-512 MB |\n| `medium` | 1-2 | 512 MB-1 GB |\n| `large` | 2-4 | 1-2 GB |\n\nBilling is pay-per-use, with a free tier of 2 million requests per month.\n\n## Deploying code\n\nDeploy from a local directory to an existing container:\n\n```bash\ndanube rapids deploy my-api\n```\n\nDeploy a specific directory:\n\n```bash\ndanube rapids deploy my-api --dir ./app\n```\n\nDeploy without waiting for the build to complete:\n\n```bash\ndanube rapids deploy my-api --no-wait\n```\n\nThe CLI packages your files into a ZIP, uploads them, and polls the build status every 2 seconds (timeout: 10 minutes).\n\n### Container resolution\n\nYou can reference containers by name, slug, ID, or ID prefix:\n\n```bash\ndanube rapids deploy my-api          # by name\ndanube rapids deploy 42              # by ID\ndanube rapids deploy a1b2            # by ID prefix\n```\n\n## Viewing container details\n\n```bash\ndanube rapids show my-api\n```\n\nDisplays:\n- ID, status, and deployment type\n- Image and port\n- Resource profile and monthly cost\n- Scaling configuration (min/max replicas, metric, targets)\n- Environment variables (values masked)\n\n## Updating a container\n\nUpdate any configuration without redeploying:\n\n```bash\n# Change resource profile\ndanube rapids update my-api --profile medium\n\n# Update scaling\ndanube rapids update my-api --min-scale 1 --max-scale 20\n\n# Change scaling metric\ndanube rapids update my-api --scaling-metric concurrency --concurrency-target 50\n\n# Set request timeout (max 3600 seconds)\ndanube rapids update my-api --timeout 300\n\n# Update Docker image\ndanube rapids update my-api --image node --tag 22-alpine\n\n# Add/update environment variables\ndanube rapids update my-api --env DATABASE_URL=postgres://... --env API_KEY=secret\n\n# Remove environment variables\ndanube rapids update my-api --rm-env OLD_KEY UNUSED_KEY\n\n# Combine multiple updates\ndanube rapids update my-api \\\n  --profile large \\\n  --min-scale 2 \\\n  --max-scale 50 \\\n  --env NODE_ENV=production\n```\n\n`update` returns as soon as the change is accepted. To block until that change\nhas been rolled out (CLI 1.3.0 and later):\n\n```bash\ndanube rapids update my-api --tag \"$SHA\" --wait --wait-timeout 10m\n```\n\n`--wait` exits non-zero only when the rollout settled as failed; a timeout means\nit is still in progress. Changes sent while a rollout is running are queued\nbehind it, never dropped — send each change once, in a single `update`, rather\nthan as several quick calls. See [Rapids automation](rapids-automation) for\nwhat the wait checks.\n\n### Scaling options\n\n| Flag | Description | Default |\n|------|-------------|---------|\n| `--min-scale <n>` | Minimum replicas (0 = scale-to-zero) | 0 |\n| `--max-scale <n>` | Maximum replicas | 10 |\n| `--scaling-metric <metric>` | `rps` or `concurrency` | `rps` |\n| `--scaling-target <n>` | Target requests per second per pod | 100 |\n| `--concurrency-target <n>` | Target concurrent requests per pod | 100 |\n| `--timeout <seconds>` | Request timeout (max 3600) | 300 |\n\n## Deleting a container\n\n```bash\ndanube rapids rm my-api\n```\n\nPrompts for confirmation. Use `-y` to skip:\n\n```bash\ndanube rapids rm my-api -y\n```\n\n## Deployment history\n\n```bash\ndanube rapids deployments my-api\n```\n\nShows all deployments with revision number, status, image:tag, traffic percentage, and deployment date.\n\n## Usage and billing\n\n```bash\ndanube rapids usage my-api\n```\n\nDisplays:\n- Total requests\n- Total compute seconds\n- Monthly cost\n\nFilter by billing period:\n\n```bash\ndanube rapids usage my-api --period 2026-01\n```\n\n## Complete workflow example\n\n```bash\n# Install the CLI\nnpm install -g @danubedata/cli\n\n# Authenticate\ndanube login\n\n# Create a container from a Docker image\ndanube rapids create \\\n  --name my-api \\\n  --type docker_image \\\n  --image myorg/my-api \\\n  --tag v1.0.0 \\\n  --profile small \\\n  --port 8080\n\n# View the container\ndanube rapids show my-api\n\n# Update environment variables\ndanube rapids update my-api \\\n  --env DATABASE_URL=postgres://db.example.com/mydb \\\n  --env API_KEY=sk-abc123\n\n# Scale up for production\ndanube rapids update my-api \\\n  --profile medium \\\n  --min-scale 1 \\\n  --max-scale 20\n\n# Check usage\ndanube rapids usage my-api\n\n# View deployment history\ndanube rapids deployments my-api\n```\n\n## Next steps\n\n- [CLI Overview](https://docs.danubedata.ro/cli-overview) — Installation, auth, and configuration\n- [CLI: Static Sites](https://docs.danubedata.ro/cli-pages) — Static site deployment commands\n- [Serverless Containers overview](https://docs.danubedata.ro/serverless-overview) — Full product reference\n- [Serverless Invoking](https://docs.danubedata.ro/serverless-invoking) — Code examples for calling your containers\n\n---\n\n**Questions?** Contact support at support@danubedata.ro\n","prev":{"title":"Static Sites","slug":"cli-pages","url":"https://docs.danubedata.ro/cli-pages","markdown_url":"https://docs.danubedata.ro/cli-pages.md","json_url":"https://docs.danubedata.ro/cli-pages.json"},"next":{"title":"API Overview","slug":"api-overview","url":"https://docs.danubedata.ro/api-overview","markdown_url":"https://docs.danubedata.ro/api-overview.md","json_url":"https://docs.danubedata.ro/api-overview.json"},"index_url":"https://docs.danubedata.ro/index.json"}