Skip to content

Commit 6bb668c

Browse files
authored
Merge pull request kubernetes#92204 from dims/check-for-either-docker-or-containerd-getting-active
Check for either docker or containerd getting active
2 parents 78b503d + 01183e5 commit 6bb668c

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

cluster/gce/gci/configure.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,16 +376,7 @@ function try-load-docker-image {
376376
set +e
377377
local -r max_attempts=5
378378
local -i attempt_num=1
379-
380-
if [[ "${CONTAINER_RUNTIME_NAME:-}" == "docker" ]]; then
381-
load_image_command=${LOAD_IMAGE_COMMAND:-docker load -i}
382-
elif [[ "${CONTAINER_RUNTIME_NAME:-}" == "containerd" ]]; then
383-
load_image_command=${LOAD_IMAGE_COMMAND:-ctr -n=k8s.io images import}
384-
else
385-
load_image_command="${LOAD_IMAGE_COMMAND:-}"
386-
fi
387-
388-
until timeout 30 ${load_image_command} "${img}"; do
379+
until timeout 30 ${LOAD_IMAGE_COMMAND:-docker load -i} "${img}"; do
389380
if [[ "${attempt_num}" == "${max_attempts}" ]]; then
390381
echo "Fail to load docker image file ${img} after ${max_attempts} retries. Exit!!"
391382
exit 1

test/e2e_node/runner/remote/run_remote.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,13 +668,15 @@ func createInstance(imageConfig *internalGCEImage) (string, error) {
668668
// TODO(random-liu): Remove the docker version check. Use some other command to check
669669
// instance readiness.
670670
var output string
671-
output, err = remote.SSH(name, "docker", "version")
671+
output, err = remote.SSH(name, "sh", "-c",
672+
"'systemctl list-units --type=service --state=running | grep -e docker -e containerd'")
672673
if err != nil {
673-
err = fmt.Errorf("instance %s not running docker daemon - Command failed: %s", name, output)
674+
err = fmt.Errorf("instance %s not running docker/containerd daemon - Command failed: %s", name, output)
674675
continue
675676
}
676-
if !strings.Contains(output, "Server") {
677-
err = fmt.Errorf("instance %s not running docker daemon - Server not found: %s", name, output)
677+
if !strings.Contains(output, "docker.service") &&
678+
!strings.Contains(output, "containerd.service") {
679+
err = fmt.Errorf("instance %s not running docker/containerd daemon: %s", name, output)
678680
continue
679681
}
680682
instanceRunning = true

0 commit comments

Comments
 (0)