test-kitchen / kitchen-dokken

Test Kitchen driver/provisioner for lightning faster Chef Infra cookbook testing with Docker
Other
196 stars 91 forks source link

dokken failure on WSL1 + Docker Desktop on Windows 10 #299

Open rliu0009 opened 1 year ago

rliu0009 commented 1 year ago

:speaking_head: Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

:ghost: Brief Description

We are trying to setup a kitchen environment with WSL1 + Docker Desktop on Windows 10. docker command on WSL talks to Docker Desktop via environment variable DOCKER_HOST set to tcp://localhost:2375, standard docker commands run well with correct information returned.

With this setup, I could create a kitchen with no issue, however, I got "sh: /opt/kitchen/run_command: No such file or directory" error when trying kitchen converge.

There are two issues involved here.

1) "remote_docker_host" is set to false instead of true in our setup because the logic at https://github.com/test-kitchen/kitchen-dokken/blob/main/lib/kitchen/helpers.rb#L264 is incomplete. Though I have docker_host_url set with tcp, the OperatingSystem is Docker Desktop in my case which leads to a false return 2) Even remote_docker_host is set to false, the upload function (https://github.com/test-kitchen/kitchen-dokken/blob/main/lib/kitchen/provisioner/dokken.rb#L63) fails with a unknown reason to me, that leaves no content in /opt/kitchen on the container hence the "No such file or directory" error is returned

Version

Chef Workstation version: 23.7.1042 Cookstyle version: 7.32.2 Chef Infra Client version: 18.2.7 Chef InSpec version: 5.22.3 Chef CLI version: 5.6.12 Chef Habitat version: 1.6.652 Test Kitchen version: 3.5.0 Docker Desktop: 4.21.0

Environment

WSL1 + Docker Desktop on Windows 10, with CentOS 8 container

kitchen.yml:

---
driver:
  name: dokken
  # Connecting to Docker Desktop running on Windows from WSL
  #docker_host_url: tcp://127.0.0.1:2375
  #docker_registry: docker.artifactory2.westpac.co.nz

provisioner:
  name: dokken

transport:
  name: dokken

verifier:
  name: inspec

platforms:
  - name: centos-8
    driver:
      image: dokken/centos-8

suites:
  - name: default
    verifier:
      inspec_tests:
        - test/integration/default

Scenario

A complete kitchen run from creation to verification with dokken

Steps to Reproduce

Execute "kitchen converge"

Expected Result

converge finishes successfully

Actual Result

Getting "sh: /opt/kitchen/run_command: No such file or directory" error

:heavy_plus_sign: Additional context

Add any other context about the problem here. e.g. related issues or existing pull requests.