GoogleContainerTools / container-structure-test

validate the structure of your container images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

container-structure-test behaves differently on two identical machines

iGulitch opened this issue · comments

Hi, everyone!

I got the following problem. There are two machines, PC and laptop, and both are used to build Docker images. The machines are nearly identical in terms of hardware [graphics card is different, that's it most likely] and are even more similar in terms of software. Both are with Ubuntu 20.04, regularly upgraded, the same apt list --installed output, etc.

Here is my unit_tests json file with settings:

{
  "schemaVersion": "2.0.0",
  "metadataTest": {
    "user": "11042",
    "workdir": "/work",
    "entrypoint": [
      "/sbin/tini",
      "--"
    ],
    "cmd": [
      "bash"
    ],
    "env": [
      {
        "key": "USERID",
        "value": "11042"
      }
    ]
  },
  "fileExistenceTests": [
    {
      "name": "Check starting script",
      "path": "/usr/bin/start-container",
      "uid": 11042,
      "gid": 11042,
      "permissions": "-rwxr-xr-x",
      "shouldExist": true,
      "isExecutableBy": "owner"
    }
  ],
  "commandTests": [
    {
      "name": "Check archiver",
      "command": "which",
      "args": [
        "p7zip"
      ],
      "expectedOutput": [
        "/usr/bin/p7zip"
      ]
    }
  ]
}

No tabs, only spaces, tabulation is correct.

To test the container structure, I perform container-structure-test test --image aab11964e491 --config /tmp/unit_tests.json, where aab11964e491 is the Docker image ID. All tests are passed successfully on PC, but on laptop they fail:

========================================
====== Test file: unit_tests.json ======
========================================
=== RUN: Check archiver
--- FAIL
duration: 0s
Error: error setting env vars: Error creating container: no such image
=== RUN: Check starting script
--- FAIL
duration: 0s
Error: error setting env vars: Error creating container: no such image
=== RUN: Metadata Test
--- FAIL
duration: 0s
Error: Error retrieving image config: Error when inspecting image: no such image

=========================================
================ RESULTS ================
=========================================
Passes:      0
Failures:    3
Duration:    0s
Total tests: 3

FAIL
FATA[0000] FAIL

What could be the problem?
I tried versions 1.14.0 and 1.15.0 of the tool. The same result.

Thanks!

cst ultimately calls down to the underlying driver on the host. Assuming this is using the default docker driver, can you confirm that the image exists on both machines? The error indicates that cst cannot create a test container because the image you are specifying doesn't exist.

I confirm that image exists on both machines and works properly.
The image is successfully built any time on both machins using the corresponding Makefile and the json file with settings and it works properly. However, once again, cst fails only on the laptop.