# Serverless Containers Quick Start

Deploy your first serverless container on DanubeData in under 5 minutes.

## Prerequisites

- A DanubeData account with an active team
- A container image (Docker Hub, GitHub Container Registry, etc.) or a Git repository with your application code

## Option A: Deploy a Docker image

### Step 1: Create a container

1. Navigate to **Serverless Containers** in the sidebar
2. Click **Create Container**
3. Select **Docker Image** as the deployment type

### Step 2: Configure the image

1. Enter a **name** for your container (e.g., `my-api`)
2. Enter the **image** URL (e.g., `docker.io/library/nginx:alpine`)
3. Set the **port** your application listens on (e.g., `80` for nginx, `3000` for Node.js, `8080` for Go). [Some ports are reserved by the platform](https://docs.danubedata.ro/serverless-overview#reserved-ports).

DanubeData validates that the image exists and is pullable before proceeding.

### Step 3: Select resources

Choose a resource profile:

| Profile | vCPU | Memory |
|---------|------|--------|
| **Free** | 0.01 - 0.1 | 64 - 128 MB |
| **Micro** | 0.1 - 1 | 256 - 512 MB |
| **Small** | 0.5 - 1 | 256 - 512 MB |
| **Medium** | 1 - 2 | 512 MB - 1 GB |
| **Large** | 2 - 4 | 1 - 2 GB |

Profiles have no fixed monthly fee — serverless billing is pay-per-use (vCPU-seconds, memory GiB-seconds, requests) with a free tier that includes 2M requests per month.

Configure scaling:
- **Min replicas** — Set to `0` for scale-to-zero (default) or `1` to avoid cold starts
- **Max replicas** — Maximum number of instances (default: `10`)

### Step 4: Add environment variables (optional)

Add any environment variables your application needs:
- Database connection strings
- API keys and secrets
- Application configuration

### Step 5: Deploy

Click **Create Container**. DanubeData will:

1. Generate a Knative Service manifest
2. Deploy via GitOps (ArgoCD)
3. Provision a TLS certificate

Your container will be accessible at:

```
https://my-api-{team-name}.danubedata.run
```

## Option B: Deploy from a Git repository

### Step 1: Create a container

1. Navigate to **Serverless Containers** in the sidebar
2. Click **Create Container**
3. Select **Git Repository** as the deployment type

### Step 2: Connect your repository

1. Enter your **repository URL** (e.g., `https://github.com/yourorg/yourapp`)
2. Select the **branch** to deploy (defaults to `main`)
3. Choose authentication:
   - **None** — For public repositories
   - **SSH Key** — Paste your SSH private key
   - **Access Token** — Paste a personal access token

### Step 3: Configure the build

Choose your build method:

- **Buildpacks (recommended)** — Auto-detects your runtime. No Dockerfile needed.
- **Dockerfile** — Uses your own Dockerfile. Specify the path if it's not in the repo root.

If using Buildpacks, DanubeData auto-detects your runtime from files like `package.json` (Node.js), `requirements.txt` (Python), `go.mod` (Go), etc.

### Step 4: Select resources and deploy

1. Choose a resource profile
2. Set scaling parameters
3. Add environment variables
4. Click **Create Container**

DanubeData will clone your repository, build the image, push it to the registry, and deploy it.

### Step 5: Set up webhooks (optional)

For automatic builds on every push:

1. Navigate to the container detail page
2. Go to the **Activity** tab
3. Copy the **Webhook URL** and **Webhook Secret**
4. Add a webhook in your Git provider settings (GitHub, GitLab, or Bitbucket)

## Verify your deployment

Once the status shows **Running**:

```bash
# Test your container
curl https://my-api-{team-name}.danubedata.run

# Check with verbose output
curl -v https://my-api-{team-name}.danubedata.run
```

## What's next

- [Add a custom domain](https://docs.danubedata.ro/serverless-domains) — Use your own domain with automatic TLS
- [Configure authentication](https://docs.danubedata.ro/serverless-authentication) — Secure your endpoints
- [View code examples](https://docs.danubedata.ro/serverless-invoking) — Call your container from any language
- [Learn about scaling](https://docs.danubedata.ro/serverless-overview#scaling) — Configure auto-scaling and scheduled scaling

Picked the wrong deployment method? You can switch a container between Docker image, Git repository, and ZIP upload later from its **Edit** page — see [Changing the deployment source](https://docs.danubedata.ro/serverless-overview#changing-the-deployment-source).

---

**Questions?** Contact support at support@danubedata.ro
