> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Container Previews

export const CenteredImage = ({src, alt, width, caption, className}) => {
  const [basePath, setBasePath] = useState("");
  useEffect(() => {
    const path = window.location.pathname;
    setBasePath(path === "/docs" || path.startsWith("/docs/") ? "/docs" : "");
  }, []);
  return <Frame caption={caption} className={className} style={{
    maxWidth: width,
    marginInline: "auto"
  }}>
			<OptimizedImage src={`${basePath}${src}`} alt={alt} />
		</Frame>;
};

Deploy container image previews with enterprise-grade security and performance.
Namespace's Previews enable development teams to test applications in isolated, ephemeral environments accessible to the whole team enabling quick feedback cycles.

## Getting Started

<Steps titleSize="h3">
  <Step title="Ensure access to Namespace">
    Using the [CLI](/docs/reference/cli/installation), log into your workspace.
    If you're accessing Namespace from a cloud provider or your CI platform, we recommend to set up [workflow federation](/docs/federation) instead.

    ```bash theme={null}
    nsc login
    ```
  </Step>

  <Step title="Start your preview">
    ```bash theme={null}
    nsc run --image nginx -p 80
    ```

    Which prints a preview URL:

    ```text nocopy Output theme={null}
    https://4bi2reg-grijlvs6ciapa.ord2.namespaced.app
    ```
  </Step>

  <Step title="Done!">
    Your preview is now available. All requests to the exposed URL require authentication.
  </Step>
</Steps>

## How it works

Namespace preview clusters build on [Namespace Compute](/docs/architecture/compute) to deliver interactive access to a flexible, isolated test environment.
Any public images, or any image present in your [private container registry](/docs/architecture/storage/container-registry) can seamlessly run in a preview.
Namespace generates public, authenticated ingress URLs using managed TLS certificates, whether you use a Namespace-provided app domain, or employ [custom domain configurations](/docs/architecture/networking/ingress#custom-domain).

<CenteredImage width={400} alt="Preview Access" src="/docs/images/previews/access.png" />

Namespace ingresses preserve original headers for application-level routing and support path-based and header-based
routing within your application.

### Monitoring and Debugging

By building on [Namespace Compute](/docs/architecture/compute), you directly benefit from its comprehensive observability features providing deep insights into preview environment performance and behavior.

* **Real-time Logging** Access centralized logs from all pods, from the CLI or the [Dashboard](https://cloud.namespace.so).
* **Performance Monitoring** Track resource utilization and network performance.

<CenteredImage width={600} alt="Preview Summary" src="/docs/images/previews/containersummary.png" />

Namespace also grants root [SSH access](/docs/architecture/compute/ssh-remote-display#ssh-access) to each instance, allowing you to inspect the underlying infrastructure powering the preview.

<CenteredImage width={600} alt="Terminal access" src="/docs/images/previews/containerterminal.png" />

## Wildcard Ingresses

For complex applications requiring multiple endpoints or dynamic routing, Namespace supports wildcard ingress configurations.
Wildcard ingresses excel in scenarios requiring microservice architectures with dynamic service discovery and when testing API gateways managing multiple backend services.

<Steps titleSize="h3">
  <Step title="Enable wildcard support">
    Create an instance with wildcard ingress capability.

    ```bash theme={null}
    nsc create --ingress wildcard
    ```

    This outputs the ID of the created cluster, e.g.: 072higp5dg0bg
  </Step>

  <Step title="Start your application">
    Connect your local Docker to the remote preview environment.

    ```bash theme={null}
    nsc docker attach-context --to 072higp5dg0bg --use
    ```

    Using your existing tooling, you can now run your application in the preview.

    ```bash theme={null}
    docker run --name nginx-foobar -p 80:80 -d nginx
    ```
  </Step>

  <Step title="Configure a wildcard ingress">
    ```bash theme={null}
    nsc expose container 072higp5dg0bg --wildcard --container nginx-foobar --container_port 80
    ```
  </Step>
</Steps>

After creating a wildcard ingress, all subdomain traffic is routed to your specified service:

`*.<instance-id>.<region>.namespaced.app`
