Technical Blog of Francis Setash

cDscDocker 1.2.0 - Now With Daemon Support

Posted on — Nov 16, 2016

Woohoo; now we’re cooking with fire. The cDscDocker resource has been updated to include giving the ability to expose the docker daemon on an interface address of your choice.

Sidebar: this was insanely frustrating as docker is picky about text encoding in daemon.json, and PowerShell Out-File does not support UTF8 encoding without BOM. Fun times trying to troubleshoot why docker suddenly wouldnt start.

Either way, the links:

PowerShell Gallery GitHub

A few notes to follow:

Known quirks:

  Example:

Configuration dockerConfig
{
    Import-DscResource -module cDscDocker

    Node localhost{

    LocalConfigurationManager
    {
        RebootNodeIfNeeded = $true
    }
        cDscDocker test
        {
            docker = "docker" #key; mandatory

            Ensure = 'Present' #mandatory field (Available options: Present, Absent)

            swarm = 'Active' #mandatory field (Available options: Active, Inactive)

            swarmToken = "SWMTKN-1-guidguidguidguidguidguidguidguid" #your swarm token here

            swarmURI = "192.168.1.100:2377" #IP address of manager node

            exposeApi = $true #this is a boolean value; not an enum like the the Ensure ["Present","Absent"] option above

            daemonInterface = 'tcp://0.0.0.0:2375' #must be full URI format mimicing a daemon.json key-value


        }
    }
}

dockerConfig

Full source on GitHub.  

If you run into any quirks, bugs, or otherwise have a suggestion - reach out. The next release will likely be mostly refactoring a bit and improving error checking for oddities like errored docker service states.