Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows fails w. Kitchen b/c Unix Socket usage #318

Closed
darkn3rd opened this issue Nov 16, 2018 · 7 comments
Closed

Windows fails w. Kitchen b/c Unix Socket usage #318

darkn3rd opened this issue Nov 16, 2018 · 7 comments

Comments

@darkn3rd
Copy link

Running kitchen create fails with Docker-for-WIndows.

STEPS

> kitchen create

The config is the following:

---
driver:
  name: docker

provisioner:
  name: chef_zero
  log_level: <%= ENV['CHEF_LOG_LEVEL'] || "auto" %>

verifier:
  name: inspec
  sudo: true

platforms:
  - name: ubuntu-16.04

suites:
  - name: default
    run_list:
      - recipe[ez_apache::default]
    verifier:
      inspec_tests:
        - ../../../inspec/ez_apache/test/integration
      attributes:
        service_type: sysv
    attributes:

EXPECTED RESULTS

Will be able to do kitchen create the same way I can for Linux, or Mac w/ Docker-for-Mac.

The plug-in should detect it is in Windows environment, and use an alternative means to communicate to Docker service. The docker client commands work fine, as well as docker python library through docker-compose.

ACTUAL RESULTS

The default behavior is to use the Unix socket, which well, on Windows, is not going to work very well.

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of docker -H unix:///var/run/docker.sock build -f Dockerfile-kitchen20181116-14652-1p671jw . ----
STDOUT:
STDERR: protocol not available
---- End output of docker -H unix:///var/run/docker.sock build -f Dockerfile-kitchen20181116-14652-1p671jw . ----
Ran docker -H unix:///var/run/docker.sock build -f Dockerfile-kitchen20181116-14652-1p671jw . returned 1] on default-ubuntu-1604
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
@darkn3rd
Copy link
Author

This is an enhancement request to have intelligent defaults.

  1. if DOCKERHOST set, default to set socket to this.
  2. if on Windows, e.g. RUBY_PLATFORM =~ /mingw32/, then use npipe.
  3. otherwise use default.

@darkn3rd
Copy link
Author

As a workaround I am doing this:

<% @socket = ENV['DOCKER_HOST'] ||
     RUBY_PLATFORM =~ /mingw32/ ?
       'npipe:////./pipe/docker_engine' :
       'unix:///var/run/docker.sock'
%>
driver:
  name: docker
  socket: <%= @socket %>

I am making tutorial material that will work on Win/Lin/Mac, and would prefer not to overwhelm new comers.

@lmayorga1980
Copy link

I wonder if its possible to use this project to launch Windows Containers in a Windows Docker Host.

@jeffreycoe
Copy link
Contributor

@lmayorga1980 Have you tried testing the code in PR #340? We’re looking for people to test and provide feedback as we continue to refine the code.

@lmayorga1980
Copy link

Definitely will test, I have a Windows 2019 Core Docker host ready to go...

@jeffreycoe
Copy link
Contributor

@lmayorga1980 Thanks — please update the PR #340 if you run into any issues.

@jeffreycoe
Copy link
Contributor

Release 2.10 contains Windows support now. Please open a new issue if any problems are found using this release. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants