# Installation

To run the Kubetail CLI tool (`kubetail`) inside a container you can use the [`kubetail-cli`](https://hub.docker.com/r/kubetail/kubetail-cli) docker image. The image is published to Docker Hub and the GitHub Container Registry on every release:

| Registry | Image |
|----------|-------|
| Docker Hub | `kubetail/kubetail-cli` |
| GHCR | `ghcr.io/kubetail-org/kubetail-cli` |

Two variants are available:

| Tag suffix | Base image | Description |
|------------|------------|-------------|
| _(none)_ | `scratch` | Minimal image, smallest footprint |
| `-alpine` | `alpine` | Includes a shell and standard utilities |

## Docker Run

To use the CLI tool locally with `docker run` you need to mount your local `.kube/config` file into a `kubetail-cli` container: 

```sh
docker run --rm -it \
  -v ~/.kube/config:/root/.kube/config:ro \
  kubetail/kubetail-cli logs \
  --kubeconfig /root/.kube/config \
  -f \
  deployments/my-app
```

You can also use the `sh` entrypoint to start an interactive session:

```sh
docker run --rm -it \
  -v ~/.kube/config:/root/.kube/config:ro \
  --entrypoint sh \
  kubetail/kubetail-cli
```

## Docker Compose

To use the CLI tool locally with `docker-compose` you can use this [docker-compose.yml](https://raw.githubusercontent.com/kubetail-org/kubetail/refs/heads/main/config/examples/docker-compose.yml) config file to get started:

```sh
curl -LO https://raw.githubusercontent.com/kubetail-org/kubetail/refs/heads/main/config/examples/docker-compose.yml
docker-compose up
```

This will mount your local `.kube/config` file into a `kubetail-cli` container and start the dashboard server at [http://localhost:7500](http://localhost:7500).

## Kubernetes Pod

To use the CLI tool inside a cluster you can use this [`kubetail-cli-pod.yaml`](https://raw.githubusercontent.com/kubetail-org/kubetail/refs/heads/main/config/examples/kubetail-cli-pod.yaml) manifest file to get started:

```sh
kubectl add -f https://raw.githubusercontent.com/kubetail-org/kubetail/refs/heads/main/config/examples/kubetail-cli-pod.yaml
```

This will start a `kubetail-cli` container inside the default namespace with access to pod logs in the same namespace. Once the pod is running you can `exec` into it and run CLI commands using the `--in-cluster` flag:

```sh
kubectl exec -it kubetail-cli -- sh
# ./kubetail logs --in-cluster -f deployments/my-app
```