Giter VIP home page Giter VIP logo

winc's Introduction

winc

winc is a CLI tool for spawning and running containers on Windows according to the OCI specification.

Building

Requirements

  • Golang
    • Make sure you have set a GOPATH
  • Git
  • mingw-w64
    • Select x86_64 as the target architecture
    • After install, ensure that gcc.exe is in your PATH

To clone and build winc.exe:

go get -d code.cloudfoundry.org/winc/...
cd $GOPATH/src/code.cloudfoundry.org/winc
./scripts/build.ps1

Testing

Set the WINC_TEST_ROOTFS environment variable to the path to a container image, e.g. in powershell to test with the microsoft/windowsservercore Docker image:

$env:WINC_TEST_ROOTFS = (docker inspect microsoft/windowsservercore | ConvertFrom-Json).GraphDriver.Data.Dir

To install Ginkgo and run the tests:

go get github.com/onsi/ginkgo/...
cd $GOPATH/src/code.cloudfoundry.org/winc
ginkgo -r -race -keepGoing

Using

The following powershell script can be used to quickly create a new container. It takes an optional container ID as an argument. It requires winc.exe and winc-image.exe to be on your path, and quota.dll to be in the same directory as winc-image.exe. $env:WINC_TEST_ROOTFS must be set.

if (!(Get-Command "winc.exe" -ErrorAction SilentlyContinue)) {
   Write-Host "Unable to find winc.exe"
   Exit 1
}

if (!(Get-Command "winc-image.exe" -ErrorAction SilentlyContinue)) {
   Write-Host "Unable to find winc-image.exe"
   Exit 1
}

$wincImageParent = Split-Path (Get-Command winc-image.exe).Path
$quotaDllPath = Join-Path "$wincImageParent" "quota.dll"
if (!(Test-Path $quotaDllPath)) {
   Write-Host "Unable to find quota.dll in the same directory as winc-image.exe"
   Exit 1
}

$containerId = $args[0]
if (!$containerId) {
  $containerId = [guid]::NewGuid()
}

$rootfs = $env:WINC_TEST_ROOTFS 

$config = winc-image.exe create $rootfs $containerId | ConvertFrom-Json
$config.ociVersion = "1.0.0-rc6"
$config.PSObject.Properties.Remove("rootfs")

$containerDir = Join-Path $env:TEMP $containerId
$configPath = Join-Path $containerDir "config.json"
rm -Recurse -Force -ErrorAction SilentlyContinue $containerDir
mkdir $containerDir | Out-Null
Set-Content -Path $configPath -Value ($config | ConvertTo-Json)

winc.exe --root "C:\var\lib\winc-image" create -b $containerDir $containerId

Write-Host "Created container $containerId"

winc's People

Contributors

crawsible avatar joshzarrabi avatar mdelillo avatar mhoran avatar natalieparellano avatar sesmith177 avatar simonjjones avatar sunjaybhatia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.