Metadata Cmd test failing but reported expected and actual values are identical
mjeco opened this issue · comments
The Metadata Cmd test is returning failing but the actual and expected CMD values are the same.
=== RUN: Metadata Test
--- FAIL
duration: 0s
Error: Image Cmd [/bin/sh -c /usr/local/bin/python main.py] does not match expected Cmd: [/bin/sh -c /usr/local/bin/python main.py]
I'm running this with gcr.io/gcp-runtimes/container-structure-test:v1.10.0
and the following config.yaml
schemaVersion: 2.0.0
metadataTest:
cmd: ["/bin/sh -c /usr/local/bin/python main.py"]
The error message comes from metadata.go:L135 which compares len(*mt.Cmd)
to len(imageConfig.Cmd)
.
Excuse me for digging up this issue. 😅
What is the format of CMD
of your Dockerfile? 🤔
Did you use the CMD
in shell form? If so, the documentation states :
If you use the shell form of the
CMD
, then the<command>
will execute in/bin/sh -c
Example:
# Dockerfile
CMD /usr/local/bin/python main.py
metadataTest:
cmd: ["/bin/sh", "-c, "/usr/local/bin/python main.py"]
For me it was the issue 😅