How To Install Latest Nuget In Dockerfile For Windows


Hello everybody,

today I want to write few words about how to instal latest Nuget into Windows docker container. For this purpose you can use following commands:

RUN mkdir c:\Nuget
RUN Invoke-WebRequest '' -OutFile 'c:\Nuget\nuget.exe'; \
$env:PATH = $env:PATH + 'c:\Nuget\;c:\Nuget'; \
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH

No Comments

Add a Comment


How To Copy Folder In Dockerfile


Hello everybody,

recently I had following issue:

copy folder dotnet-dev-win-x64.1.0.1 into c:\Program Files\Dotnet in container. After different dancing and triings I've found following command that worked:

COPY ["dotnet-dev-win-x64.1.0.1", "c:/Program Files/dotnet"]

No Comments


Add a Comment


Working With Dockerfile


Hello everybody,

today I want to write a few words about Dockerfile. 

So, as usually for developer it will not be enough just ordinary docker images. Quite often they need to add some more features to docker images. One of the useful ways to organize it can be creating Dockerfile. 

Dockerfile in itself just a text file with instructions. Of course that instructions are docker specific. And it's similar to making program say in C#. While after C# program I need to execute compiler, with Dockerfile I need to execute command docker build. You can consider docker build as compiler from Docker. 

Executed image is a container. 

Dockerfile has build instructions. 

Some docker instructions

FROM - points to basic image. 

MAINTEINER - say who maintains image

RUN - with this command you can point either you need to download something from internet, compile source code, RUN npm install, etc

COPY - copy something into container

ENTRYPOINT - what is main entrypoint of your container. Something that starts container functionality. javatype, nodejs, dnx, etc types of commands

WORKDIR - configure context for where that container is executed

EXPOSE - expose port

ENV - define environment varialbes

VOLUME - define volume and how it is stored in host system

Some samples of instructions:

FROM node - means the following from node build an image, grab node, and add additional layers on top of it

MAINTAINER - to whom write an email.

RUN npm install - execute npm install command

EXPOSE 8080 - open port 8080

COPY . /app - copy content of local folder into folder app

After you created your docker file, you can use docker build like tis

docker build -t somename/aspnetcore .

Take not that . in the end is named Build context. It shows where is Dockerfile.

No Comments

Add a Comment


How To Analyze Condition Of Your Docker Under Windows


Hello everybody,

today I want to share one more piece of search, which I've found today.

My current situation with docker is the following: it refuses to be executed.

In order to see, why, following command can be used:

wget -UseBasicParsin | iex

This command gave me following output:

Describing Windows Version and Prerequisites
[+] Is Windows 10 Anniversary Update or Windows Server 2016 86ms
[+] Has KB3192366, KB3194496, or later installed if running Windows build 14393 17ms
[+] Is not a build with blocking issues 16ms
[+] Has 'Containers' feature installed 9.78s
Describing Docker is installed
[+] A Docker service is installed - 'Docker' or 'com.Docker.Service' 33ms
[+] Service is running 14ms
[+] Docker.exe is in path 2.09s
[+] Docker is registered in the EventLog service 91ms
Describing User has permissions to use Docker daemon
[+] docker.exe should not return access denied 26ms
Describing Windows container settings are correct
[+] Do not have DisableVSmbOplock set to 1 29ms
[+] Do not have zz values set 21ms
[+] Do not have FDVDenyWriteAccess set to 1 26ms
Describing The right container base images are installed
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/images/json: open //./pipe/docker_engine: The syst
em cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevate
d to connect. This error may also indicate that the docker daemon is not running.
[-] At least one of 'microsoft/windowsservercore' or 'microsoft/nanoserver' should be installed 235ms
ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then t
ry the command again.
ParameterBindingValidationException: Cannot validate argument on parameter 'Property'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
at <ScriptBlock>, <No file>: line 115
Describing Container network is created
[+] At least one local container network is available 1.06s
[-] At least one NAT, Transparent, or L2Bridge Network exists 53ms
Expected {0} to be greater than {0}
206: $totalnets | Should BeGreaterThan 0
at <ScriptBlock>, <No file>: line 206
[-] NAT Network's vSwitch is internal 88ms
Expected: {Internal}
But was: {}
211: $switchType | Should Be "Internal"
at <ScriptBlock>, <No file>: line 211
[-] Specified Network Gateway IP for NAT network is assigned to Host vNIC 23ms
Expected: value to not be empty
215: $natGatewayIP | Should Not BeNullOrEmpty
at <ScriptBlock>, <No file>: line 215
[-] NAT Network's internal prefix does not overlap with external IP' 53ms
Expected {0} to be greater than {0}
242: $hostips.Count | Should BeGreaterThan 0
at <ScriptBlock>, <No file>: line 242
Showing output from: docker info

Showing output from: docker version
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: windows/amd64

Showing output from: docker network ls

Getting Warnings & errors in the Windows event logs from the last 24 hours
Logs saved to C:\Program Files\docker\docker\logs_20170413-112337.csv

Getting Docker for Windows daemon logs from the last execution
Note: More logs are available at C:\Users\yuriy.zaletskyy\AppData\Local\Docker. Only showing the latest.

Most important part of this output is log file location, which can give another push on how to start your docker.

No Comments

Add a Comment


How To Manage Docker From C With Ssh


Hello everybody,

today I want to write a few words about how to work with Docker with help of C#.

Recently I've got a challenge to find the way how to manage Docker. Initially I've tried Docker.Dotnet library. It has quite interesting options for management of docker, but from my own prospective it's not very convenient for management.  After some trial/error efforts I've decided to try another option. I tried using SSH connection in order to manage linux instance with Docker. In order to have access to CentOs I've used SSH.Net.

In order to have option for mocking of SSH I've created following interface:

    public interface ISshManager
        string IpHost { get; set; }
        string UserName { get; set; }
        string Password { get; set; }
        string ExecuteCommand(string command, string ipHost = null, string username = null, string password = null);
        void UploadFile(string sourceFile, string destination, string ipHost = null, string username = null, string password = null);
        void ExecuteBashFile(string bashSourceFile, string ipHost = null, string username = null, string password = null);
        void ExecuteBash(string bash, string ipHost = null, string username = null, string password = null);

Also I've added following implementation of this interface:

    public class SshManager : ISshManager
        public string IpHost { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }

        private int _Port = 22;
        public string ExecuteCommand(string command, string ipHost = null, string username = null, string password = null)
            Init(ref ipHost, ref username, ref password);

            string result = string.Empty;

            using (var client = new SshClient(ipHost, username, password))
                result = client.RunCommand(command).Result;
            return result;

        private void Init(ref string ipHost, ref string username, ref string password)
            ipHost = ipHost ?? IpHost;
            username = username ?? UserName;
            password = password ?? Password;

        public void ExecuteBash(string bash, string ipHost = null, string username = null, string password = null)
            Init(ref ipHost, ref username, ref password);
            string result = string.Empty;

                using (var client = new SshClient(ipHost, username, password))
                    string command = bash;
                    Stream stdout = Console.OpenStandardOutput();

                    var input = new MemoryStream(Encoding.ASCII.GetBytes(command));
                    var shell = client.CreateShell(input, stdout, stdout);
                    shell.Stopped += delegate (object sender, EventArgs e)
            catch (Exception ex)
                // Exception stuff

        public void ExecuteBashFile(string bashSourceFile, string ipHost = null, string username = null, string password = null)
            string bash = File.ReadAllText(bashSourceFile);
            ExecuteBash(bash, ipHost, username, password);

        public void UploadFile(string sourceFile, string destination, string ipHost = null, string username = null, string password = null)
            Init(ref ipHost, ref username, ref password);
            using (var client = new SftpClient(ipHost, _Port, username, password))
                if (client.IsConnected)
                    string workingDirectory = destination;
                    string destinationName = workingDirectory + Path.GetFileName(sourceFile);
                    using (var fileStream = new FileStream(sourceFile, FileMode.Open))
                        client.BufferSize = 4 * 1024; // bypass Payload error large files
                        client.UploadFile(fileStream, destinationName, null);

Some examples of usage of this class:

Creation ( you can use DI for making it more beautifull )

ISshManager sshManager = new SshManager()
                    IpHost = ipHost,
                    UserName = userName,
                    Password = password

Then you can create folder:

sshManager.ExecuteCommand("mkdir -p folderName"); //create folder folderName

If you need to execute two commands, you can use && for such purpose like this:

sshManager.ExecuteCommand($"cd {folderName} &&rm docker-compose.yml -f\n ls");

Those line will go to folder folder name, and then will remove file docker-compose.yml

Also you can upload file like this:

sshManager.UploadFile("Files/RabbitMQ/docker-compose.yml", $"/{folderName}");

No Comments

Add a Comment


How To Build Private Docker Registry


Hello everybody,

today I want to describe to ways of how private registry of docker can be used and created. Before I'll go in details of it's creation I want to point what is purpose of docker registry in itself. Imagine that you spent a lot of time and money in order to create your own docker image. And for some reasons you don't want to share it with whole world, just with your own customer. What you can do? You have two options:

  1. Use private docker registry
  2. Create your own docker registry

I will omit how to use 1 for now and will go directly to point 2. 

There are two ways how to create local docker registry:

  • Direct installation
  • Registry image

Before you continue to any of two points, you'll need to have firewal opened on port 5000 ( if you like me use CentOS ). You can do it with following command:

firewall-cmd --zone=public --add-port=5000/tcp --permanent.

Direct installation or package manager

In general this way configures Docker registry with usage of yum or apt-get.

Following commands can bu usefull:

yum update

yum install docker-registry

systemctl start docker-registry

Registry image

In general this way uses Docker registry as Docker image-based container. You can use following commands:

docker pull registry:latest

docker run -p 5000:5000 registry:latest

systemctl start docker-registry

systemctl status docker-registry

Some notes

As usually instead of docker run -p 5000:5000 registry:latest it is more practially to execute docker run -p -d 5000:5000 registry:latest, so to say to execute registry image in detached mode. If to execute without key -d then as soon as you enter Ctrl+C your docker registry image will cease to exist. Also without -d allow you to monitor visually all pushes and pulls from your local registry repository. 

No Comments

Add a Comment


Container Orchestration With Kubernetes Docker Swarm And Mesos Marathon


Hello everybody,

today I want to leave few notes about following video: which is done by Adrian Mouat.

First of all, what is orchestration definition: "The planing  or coordination of the elements of a situation to produce a desired effect, especially surreptitiously". 

So, what are elements in Kubernetes, Docker Swarm and Mesos maraphon?

  1. Containers
  2. Hosts
  3. Networking

What are desired effects? Here they are:

  1. Running application
  2. Automatically scale
  3. Fault tolerant
  4. Node failover, node rebalancing, health checks
  5. Efficient use of resources
  6. Require little of manual intervention

Swarm and compose

  1. Docker official solution
  2. Uses the same API as the Docker Engine
  3. Swarm arguably mainly "clustering"
  4. Compose for "orchestration"

In other words swarm is responsible for clustering, while compose for orchestration. If to compare swarm with Mesos and Kubernetes, it's possible to say that swarm is little bit simpler then two others.


First point, which is needed to be taken into account is Scheudiling. It consists of two steps: choose host for a container, choose strategy and filters/constraints. 

Swarm has following scheduling strategies:

  • Random. Takes around host and starts there container.
  • Binpack. Completely fill container before moving to the next host.
  • Spread. Tries to spread containers evenly across all hosts.
  • Pluggable

Binpack and spread are somehow in contrast between each other. In binpack you try to use most efficient use of resources, but if one of resources will die, you'll loose much more, then in case if one of spread resources will die.

Swarm filters, they describe which container can be executed on particular node. For example:

  • Only nodes labeled staging
  • Only nodes which have image
  • Only nodes running a given container

Sample of docker compose file:

version: "2"



                      image: amouat/identiorca: 1.0








                                 image: amouat/dnmonster:1.0







In presented fragment of yml file environmnet plays role of constraint. 

this part:




means the following: redis container to come app next to identiorca_dnmonster_1. 

No Comments

Add a Comment


Windows Container Types In Docker


Hello everybody,

today I want to write a few words about two types of containers in windows:

  1. Windows server containers
  2. Hyper-V containers

Windows server containers provide application isolation through process and namespace isolation. Windows server container shares a kernel with the container host and all containres running on the host.

Hyper-V containers expand on the isolation provided by Windows server containers by running each container in a highly optimized virtual machine. In this configuration kernel of the container host is not shared with other Hyper-V containers.

No Comments

Add a Comment


Some Notes On Usage Of Docker


Hello everybody,

today I want to write a few words about usage of docker for windows.

First of all, I want to point what is docker at all. There are many ideas of how to explain it, but in my opinion docker is like installed and configured piece of software with needed fragment of operating system. It can be installed software with windows or with Linux fragment. What is also interesting is that Windows 10 with docker for windows knows how to execute Linux docker containers. So it means that from inside of windows you can have nginx Linux server.

As you can see from my screenshot, docker for windows installed MobyLinuxVM and if there is a need to execute docker contaner for Linux, it will use image from Hyper-V manager in order to execute docker app from that space.

Some commands of docker

I suppose that most usefull command of working with docker will be or could be docker ps. ps comes from Linux world and stands for process status.

Initially it will have following output:

PS C:\Windows\system32> docker ps
PS C:\Windows\system32>

Let's start with simplest possible hello world docker container:

docker run hello-world

If you run this command for the first time, the docker will make initial download of simplest image and execute for you it. If you run it for the second time you'll see following output:

PS C:\Windows\system32> docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:

PS C:\Windows\system32>

this output is intended to prove to you that docker with it's internals was installed successfully. 

Now let me introduce me docker ps -a

at my machine this command gives following output:

PS C:\Windows\system32> docker ps -a

as you can see from the picture I have plenty of images, with status Exited .... 

If you want to see working images ( or containers that you can start ) use docker images

"Install" with docker

with next command that I want to introduce is download something more complicated. For example rabbitmq image:

as you can see from the picture in order to get rabbitmq downloaded and executed I just run docker run rabbitmq.

Stop container

In order to terminate container following can be used:

docker stop some identifier. I prefer to use container id or fragment of it. Like this:

docker stop a30eaa297fa

Run IIS nanoserver

Lets suppose that for some reason you need to run IIS. 

For this purpose you can use the following command:

docker run -p 81:80 -d --name iis microsoft/iis:nanoserver

it will have the following meaning:

run latest microsoft nanoserver with mapping from port 80 of nanoserver to port 81 to external world.

-d will have following meaning: fire and forget or detached container.

As opposite to -d can be considered -it or interactive terminal.

--name allows to give to it some name which can simplify finding of needed instance.

Download without executing

One more command is usefull:

docker pull microsoft/windowsservercore

this command will download image of windowsservercore without executing it.

Get to installed IIS

If you executed docker run -p 81:80 -d --name iis microsoft/iis:nanoserver and expect that you'll be able to open in localhost your instance of IIS, prepare to be disappointed. There is a bug in Windows docker container, which will require from you additional steps.

  1. Execute docker inspect iis
  2. In the networks section you'll find Networks, which will provide you needed IP address:

3. Type that address without ( !!! ) mapping to port 81, and you'll see IIS welcome screen.

Not truncate

Take a look at screenshot below, and tell me which command was executed via docker:

Most probably you'll tell C:\ServiceMonitor... What stands instead of ...?

In order to discover it, you can use key --no-trunc. Compare with screenshot below:

with this command you can see, that following command was executed: C:\ServiceMonitor.exe w3svc.

No Comments

Add a Comment


Unit Test Abbreviations


Hello everybody,

some abbreaviations:

SUT - system under test. AKA as AUT, MUT, CUT.

DUT - device under test

DOC - depend on component

No Comments


Add a Comment