-
Notifications
You must be signed in to change notification settings - Fork 706
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Description
Healthcheck seemingly fails to capture the output of commands it runs (one time out of two or three on slow environments - one time in 30 or 40 on my local lima).
Since this is a new feature, suggesting we hold on v2.1.3 a little bit until we fix this. (<- tag @AkihiroSuda)
Steps to reproduce the issue
Here is an example of a log entry with nothing in it (while there should be).
+============================================================================================================+
| π | "TestContainerHealthCheckAdvance/Health_check_uses_container_environment_variables": setup |
+============================================================================================================+
container_health_check_test.go:331:
+------------------------------------------------------------------------------------------------------------+
| β‘οΈ | βοΈ /usr/local/bin/nerdctl run -d --name testcontainerhealthcheckadvance-health-check-uses-contai |
| | ner-environ-285e8021 --env MYVAR=test-value --health-cmd echo $MYVAR --health-interval 1s --heal |
| | th-timeout 1s ghcr.io/stargz-containers/alpine:3.13-org sleep 3600 |
+------------------------------------------------------------------------------------------------------------+
| | π’ f6c5e3bbcb7a9b31abffed58dcc67366b58865cefe2b1b546f44b012572fc2e7 |
+------------------------------------------------------------------------------------------------------------+
| π± | HOME=/root |
| | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
| | :/bin |
| | DOCKER_CONFIG=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variab |
| | les1890087731/003 |
| | NERDCTL_TOML=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variabl |
| | es1890087731/003/nerdctl.toml |
+------------------------------------------------------------------------------------------------------------+
| β° | <1s (limit: 3m0s) |
+------------------------------------------------------------------------------------------------------------+
| π | /tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variables1890087731/ |
| | 002 |
+------------------------------------------------------------------------------------------------------------+
container_health_check_test.go:337:
+------------------------------------------------------------------------------------------------------------+
| β‘οΈ | βοΈ /usr/local/bin/nerdctl container inspect testcontainerhealthcheckadvance-health-check-uses-co |
| | ntainer-environ-285e8021 |
+------------------------------------------------------------------------------------------------------------+
| | Actual content is 173 lines long and has been abbreviated to 50
|
| | |
| | π’ [ |
| | { |
| | "Id": "f6c5e3bbcb7a9b31abffed58dcc67366b58865cefe2b1b546f44b012572fc2e7", |
| | "Created": "2025-06-26T03:43:36.566037659Z", |
| | "Path": "sleep", |
| | "Args": [ |
| | "3600" |
| | ], |
| | "State": { |
| | "Status": "running", |
| | "Running": true, |
| | "Paused": false, |
| | ... 123 lines are being ignored... |
| | 000000000,\"Timeout\":1000000000}", |
| | "nerdctl/host-config": "{\"BlkioWeight\":0,\"CidFile\":\"\",\"Devices\":null}", |
| | "nerdctl/hostname": "f6c5e3bbcb7a", |
| | "nerdctl/ipc": "{\"mode\":\"private\"}", |
| | "nerdctl/log-config": "{\"driver\":\"json-file\",\"address\":\"/run/containerd/c |
| | ontainerd.sock\"}", |
| | "nerdctl/log-uri": "binary:///usr/local/bin/nerdctl?_NERDCTL_INTERNAL_LOGGING=%2 |
| | Fvar%2Flib%2Fnerdctl%2F1935db59", |
| | "nerdctl/name": "testcontainerhealthcheckadvance-health-check-uses-container-env |
| | iron-285e8021", |
| | "nerdctl/namespace": "nerdctl-test", |
| | "nerdctl/networks": "[\"bridge\"]", |
| | "nerdctl/platform": "linux/amd64", |
| | "nerdctl/state-dir": "/var/lib/nerdctl/1935db59/containers/nerdctl-test/f6c5e3bb |
| | cb7a9b31abffed58dcc67366b58865cefe2b1b546f44b012572fc2e7" |
| | } |
| | }, |
| | "NetworkSettings": { |
| | "Ports": {}, |
| | "GlobalIPv6Address": "", |
| | "GlobalIPv6PrefixLen": 0, |
| | "IPAddress": "10.4.0.92", |
| | "IPPrefixLen": 24, |
| | "MacAddress": "d2:27:31:7b:40:73", |
| | "Networks": { |
| | "unknown-eth0": { |
| | "IPAddress": "10.4.0.92", |
| | "IPPrefixLen": 24, |
| | "GlobalIPv6Address": "", |
| | "GlobalIPv6PrefixLen": 0, |
| | "MacAddress": "d2:27:31:7b:40:73" |
| | } |
| | } |
| | } |
| | } |
| | ] |
| | |
+------------------------------------------------------------------------------------------------------------+
| π± | HOME=/root |
| | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
| | :/bin |
| | DOCKER_CONFIG=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variab |
| | les1890087731/003 |
| | NERDCTL_TOML=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variabl |
| | es1890087731/003/nerdctl.toml |
+------------------------------------------------------------------------------------------------------------+
| β° | <1s (limit: 3m0s) |
+------------------------------------------------------------------------------------------------------------+
| π | /tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variables1890087731/ |
| | 002 |
+------------------------------------------------------------------------------------------------------------+
container_health_check_test.go:603:
+============================================================================================================+
| π | "TestContainerHealthCheckAdvance/Health_check_uses_container_environment_variables": starting te |
| | st! |
+============================================================================================================+
| β³ | /tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variables1890087731/ |
| | 001/c59fef3d |
+============================================================================================================+
| | |
+============================================================================================================+
| config | { |
| | "Namespace": "nerdctl-test", |
| | "PrivateMode": "" |
| | } |
+============================================================================================================+
| labels | {} |
+============================================================================================================+
container_health_check_test.go:603:
+------------------------------------------------------------------------------------------------------------+
| β‘οΈ | βοΈ /usr/local/bin/nerdctl container healthcheck testcontainerhealthcheckadvance-health-check-use |
| | s-container-environ-285e8021 |
+------------------------------------------------------------------------------------------------------------+
| π± | HOME=/root |
| | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
| | :/bin |
| | NERDCTL_TOML=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variabl |
| | es1890087731/003/nerdctl.toml |
| | DOCKER_CONFIG=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variab |
| | les1890087731/003 |
+------------------------------------------------------------------------------------------------------------+
| β° | <1s (limit: 3m0s) |
+------------------------------------------------------------------------------------------------------------+
| π | /tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variables1890087731/ |
| | 002 |
+------------------------------------------------------------------------------------------------------------+
container_health_check_test.go:349:
+------------------------------------------------------------------------------------------------------------+
| β‘οΈ | βοΈ /usr/local/bin/nerdctl container inspect testcontainerhealthcheckadvance-health-check-uses-co |
| | ntainer-environ-285e8021 |
+------------------------------------------------------------------------------------------------------------+
| | Actual content is 186 lines long and has been abbreviated to 50
|
| | |
| | π’ [ |
| | { |
| | "Id": "f6c5e3bbcb7a9b31abffed58dcc67366b58865cefe2b1b546f44b012572fc2e7", |
| | "Created": "2025-06-26T03:43:36.566037659Z", |
| | "Path": "sleep", |
| | "Args": [ |
| | "3600" |
| | ], |
| | "State": { |
| | "Status": "running", |
| | "Running": true, |
| | "Paused": false, |
| | ... 136 lines are being ignored... |
| | "nerdctl/healthstate": "{\"Status\":\"healthy\",\"FailingStreak\":0}", |
| | "nerdctl/host-config": "{\"BlkioWeight\":0,\"CidFile\":\"\",\"Devices\":null}", |
| | "nerdctl/hostname": "f6c5e3bbcb7a", |
| | "nerdctl/ipc": "{\"mode\":\"private\"}", |
| | "nerdctl/log-config": "{\"driver\":\"json-file\",\"address\":\"/run/containerd/c |
| | ontainerd.sock\"}", |
| | "nerdctl/log-uri": "binary:///usr/local/bin/nerdctl?_NERDCTL_INTERNAL_LOGGING=%2 |
| | Fvar%2Flib%2Fnerdctl%2F1935db59", |
| | "nerdctl/name": "testcontainerhealthcheckadvance-health-check-uses-container-env |
| | iron-285e8021", |
| | "nerdctl/namespace": "nerdctl-test", |
| | "nerdctl/networks": "[\"bridge\"]", |
| | "nerdctl/platform": "linux/amd64", |
| | "nerdctl/state-dir": "/var/lib/nerdctl/1935db59/containers/nerdctl-test/f6c5e3bb |
| | cb7a9b31abffed58dcc67366b58865cefe2b1b546f44b012572fc2e7" |
| | } |
| | }, |
| | "NetworkSettings": { |
| | "Ports": {}, |
| | "GlobalIPv6Address": "", |
| | "GlobalIPv6PrefixLen": 0, |
| | "IPAddress": "10.4.0.92", |
| | "IPPrefixLen": 24, |
| | "MacAddress": "d2:27:31:7b:40:73", |
| | "Networks": { |
| | "unknown-eth0": { |
| | "IPAddress": "10.4.0.92", |
| | "IPPrefixLen": 24, |
| | "GlobalIPv6Address": "", |
| | "GlobalIPv6PrefixLen": 0, |
| | "MacAddress": "d2:27:31:7b:40:73" |
| | } |
| | } |
| | } |
| | } |
| | ] |
| | |
+------------------------------------------------------------------------------------------------------------+
| π± | HOME=/root |
| | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
| | :/bin |
| | DOCKER_CONFIG=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variab |
| | les1890087731/003 |
| | NERDCTL_TOML=/tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variabl |
| | es1890087731/003/nerdctl.toml |
+------------------------------------------------------------------------------------------------------------+
| β° | <1s (limit: 3m0s) |
+------------------------------------------------------------------------------------------------------------+
| π | /tmp/TestContainerHealthCheckAdvanceHealth_check_uses_container_environment_variables1890087731/ |
| | 002 |
+------------------------------------------------------------------------------------------------------------+
container_health_check_test.go:352: {
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2025-06-26T03:43:38.039774087Z",
"End": "2025-06-26T03:43:38.117066808Z",
"ExitCode": 0,
"Output": ""
}
]
}
container_health_check_test.go:356: assertion failed: expression is false: strings.Contains(h.Log[0].Output, "test"): expected health log output to contain 'test'
container_health_check_test.go:603:
Describe the results you received and expected
Work
What version of nerdctl are you using?
main
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
Host information
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working