> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-integration/troubleshooting-and-resources/ci-articles-and-faqs/articles/kaniko-container-runtime-error.md).

# Kaniko container runtime error

## Conditions <a href="#conditions" id="conditions"></a>

* Module: Harness CI
* Environment:
  * Infrastructure: Kubernetes
  * OS: Linux
* Stage: Build
* Step: Build and Push

## Problem <a href="#problem" id="problem"></a>

While building and pushing an image to a Docker registry, you get a `kaniko container runtime error`, such as:

```
kaniko should only be run inside of a container, run with the --force flag if you are sure you want to continue
exit status 1
```

![](/files/D54b8hRgtCMHtP1gMibN)

## Solution <a href="#solution" id="solution"></a>

This error can be resolved by adding a Docker container environment variable. To do this, add a [stage variable](/continuous-integration/use-harness-ci/use-harness-ci/set-up-build-infrastructure/ci-stage-settings.md#advanced-stage-variables) named `container` with the value `docker`.

You can [add stage variables](/harness-ai/use-harness-platform/pipelines/add-a-stage.md#stage-variables) in the Build stage settings, in the YAML editor, or in the pipeline's **Variables** list.

To add a variable to the pipeline's variables list:

1. Select **Variables** on the right side of the Pipeline Studio.

   ![](/files/XXXrFZQ2wSnoQZ72cIip)
2. Locate the stage where you have the **Build and Push** step.
3. Next to **Stage Variables**, select **Add Variable**, and configure the variable as follows:

   * Type: String
   * Name: `container`
   * Value: `docker`

   ![](/files/aroh8unBeQxjXujHET4g)
4. Select **Save**.
5. Select **Apply Changes**.
