Wednesday, October 19, 2016

First steps with Microsoft Containers - part 3

A lot of things could not work out of the box when you move your first steps with Docker (which we have learned to install in this previous post) under Windows 2016. This is a new project, the partnership between Microsoft and Docker is definitively recent, and while the community is contributing greatly to it, it's always good to know where the logs are when you can't get things to work, like in the following screenshot:




A post by a technical write at Microsoft showed how to use Get-EventLog to retrieve events generated by the Docker engine:
Get-EventLog -LogName Application -Source Docker -After (Get-Date).AddMinutes(-1000) |
        Sort-Object Time
Now, Get-EventLog is sort of legacy cmdlet that is supported by older versions of Windows  PowerShell.

Get-WinEvent is the cmdlet you want to be using, since it is definitively faster.




Get-WinEvent -FilterHashtable @{
        logname='application'
        providername='docker'
        starttime=((Get-Date).AddMinutes(-1000))
        }

   ProviderName: docker

TimeCreated               Id LevelDisplayName Message                                                            
-----------               -- ---------------- -------                                                            
18/10/2016 14:14:44       1  Error            Handler for GET /v1.24/images...
18/10/2016 14:14:26       1  Information      API listen on //./pipe/docker...
18/10/2016 14:14:26       11 Information      Docker daemon [version=1.12.2...
18/10/2016 14:14:26       1  Information      Daemon has completed initiali...
18/10/2016 14:14:26       1  Information      Loading containers: done.
18/10/2016 14:14:26       1  Information      Loading containers: start.
18/10/2016 14:14:26       1  Information      Graph migration to content-ad...
18/10/2016 14:14:25       1  Information      [graphdriver] using prior sto...
18/10/2016 14:14:25       1  Information      Windows default isolation mod...
The difference in performance is easily demonstrated:
Measure-Command {Get-EventLog -LogName Application -Source Docker}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 527
Ticks             : 5274839
TotalDays         : 6,10513773148148E-06
TotalHours        : 0,000146523305555556
TotalMinutes      : 0,00879139833333333
TotalSeconds      : 0,5274839
TotalMilliseconds : 527,4839

Measure-Command {Get-WinEvent -FilterHashtable @{
        logname='application'
        providername='docker'}
        }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 80
Ticks             : 801087
TotalDays         : 9,27184027777778E-07
TotalHours        : 2,22524166666667E-05
TotalMinutes      : 0,001335145
TotalSeconds      : 0,0801087
TotalMilliseconds : 80,1087

Stay tuned for more Docker tips.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...