Why Am I Getting “Kaniko container runtime error” While Pushing Images To Docker Registry?

Module

Harness CI

Environment

  • Target Infrastructure - Kubernetes

Issue

While building and pushing an image to the docker registry, one can encounter the following error:

Resolution

The resolution is to add an environment stage variable named “container” with a value “docker”.
Follow these simple steps to do add a stage variable:

Diagnostic Step

1 info 01/11/2022 13:06:02 + /kaniko/executor --dockerfile=Dockerfile --context=dir://. --destination=**************/pythonsample:latest --snapshotMode=redo --digest-file=/kaniko/digest-file
2 info 01/11/2022 13:06:02 kaniko should only be run inside of a container, run with the --force flag if you are sure you want to continue 
3 info 01/11/2022 13:06:02 exit status 1```
2 Likes