yannh / kubeconform

A FAST Kubernetes manifests validator, with support for Custom Resources!
Apache License 2.0
2.16k stars 121 forks source link

Error when running it as a Docker container #154

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello,

I'm trying to running it as a Docker container with the following command:

docker run -t -i --rm --init ghcr.io/yannh/kubeconform examples/cassandra/cassandra-service.yaml

However, I'm getting the following error: examples/cassandra/cassandra-service.yaml - failed validation: lstat examples/cassandra/cassandra-service.yaml: no such file or directory

The file does exists, but I cannot get this working. I tried also using a path rather than a single file and it fails as well.

The version used is the following one: docker run -t -i --rm --init ghcr.io/yannh/kubeconform -v v0.5.0

Please advice if there is a way to make it work with Docker. Thanks in advance

hongbo-miao commented 1 year ago

Here is how I use.

Assume you have a folder /kubernetes with many YAML files, you can mount the folder inside the container by running:

docker run \
  --rm \
  --volume=`pwd`/kubernetes:/kubernetes \
  ghcr.io/yannh/kubeconform:latest \
    -kubernetes-version=1.26.0 \
    kubernetes/

Hope it helps! 😃

ghost commented 1 year ago

Hello @Hongbo-Miao Thanks a lot for the example command. I was able to make it work on my environment.

Cheers