Interesting notes on Docker Windows containers

In this post, I collected some useful links and notes when trying out Docker on Windows with Windows containers.

Useful images

Useful commands

Some notes

  • You do not see the Mount/Disk setting in Docker when using Windows container instead of Linux container because this is not necessary according to the documentation. However, you have to pass in correct parameter for the volume; for instance, C:\data_in_host:C:\data_in_container  or C:/data_in_host:C:/data_in_container  instead of C:/data_in_host:/data_in_container . Check the following links for more information: https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-storage.
  • You cannot test with http://localhost:{host_port} on Windows. You will have to use either http://{host_name}:{host_port} or http://{container_ip}:{container_port}. To find out container IP, you can use docker inspect --format '{{ .NetworkSettings.Networks.nat.IPAddress }}' container_name.

Links & Examples

https://docs.microsoft.com/en-us/virtualization/windowscontainers

https://anthonychu.ca/post/dockerizing-aspnet-4x-windows-containers

Deploying ASP.NET Core applications to Docker containers

How to integrate Teamcity and GitLab CI

I note down the step I did to integrate TeamCity build server and GitLab CI pipeline. I am using TeamCity 2017.1.15 and GitLab 10.0.3.

What you will get with this integration:

  • Small green tick for each commit showing that a build has run successfully on the commit
  • Bigger tick for each merge request (MR) showing that a build has run successfully on the head of the merge request
  • Ability to enforce a successful build before any MR can be merged

How to set up the integration

Tldr, you need to go through 3 main steps:

  1. Enable TeamCity integration in your GitLab project settings
  2. Enable TeamCity build configuration to monitor and trigger build for all (CI) branches
  3. Enable “Commit status publisher” build feature

Read More

Migrating Legacy UUID of MongoDB to standard UUID

MongoDB has a legacy format for UUID which causes problem where the UUID is interpreted differently on different platforms, and the standard UUID solves that exact problem.
However, the C# driver defaults to use legacy format and requires switching to standard format explicitly.

Moreover, after switching to standard format, you might get Exception due to existing UUID. You can fix that Exception by using the Python script below to migrate legacy UUID to standard UUID while maintaining the same C# GUID translation:

After running the script, you can then replace ‘my_collection’ by ‘my_collection_new’.
Based on your actual need, you may also replace CSHARP_LEGACY with JAVA_LEGACY or PYTHON_LEGACY or other legacy format (http://api.mongodb.org/python/current/api/bson/binary.html).

Hope this help!

“Access is denied” when using Microsoft Speech Platform with IIS

When you are using Microsoft Speech Platform in your web service to perform speech recognition, you might find a strange situation when the web app works perfectly in Visual Studio, but keep having “Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))” when you try to instantiate SpeechRecognitionEngine.

After some searches on the Internet, I found 2 suggestions in this article http://stackoverflow.com/questions/3385382/run-microsoft-speech-over-iis:

  • Use procmon in SysInternals to find ACCESS DENIED result and add permission there
  • Grant read permission for the IIS apppool account to folder

I tried the second suggestion first as it is more straight forward, but it didn’t work out for me. I then tried the first suggestion.

Turned out the path is a bit different on my PC, probably due to x64-x86 compatibility.
Access Denied problem

I added read permission for

to the folder above (and some of its parents), and the speech platform works perfectly in IIS now.

I hope this article would help you if you have to same issue. Please also leave a comment if you have a better solution.

Building a small running bot with Windows 10 on a Raspberry Pi 2

I won a Raspberry Pi B+ from a Microsoft event, so I took some time to learn about the Pi to understand more about all the fuzz around IoT. The experience I had is very fun and excited. I study and work mainly on software engineering, so hacking the virtual world is much more familiar to me that hacking those hardware and devices in the real world. However, Raspberry Pi turned out to be the perfect device for me to learn more about this IoT area by providing a bridge between high level programming language (such as Python) and all the “complicated” GPIO and I2C stuffs. In other words, you can write Python instead of C++ or Assembly to communicate with so many electrical boards and devices. There are many interesting and easy to follow tutorials on Adafruit that I strongly recommend you to take a look and give it a try.

With the introduction of Windows 10 on Raspberry Pi 2, the small computing box becomes even more interesting to me. The Pi can now run Universal Windows apps and communicate with devices such as Xbox controller. Therefore, I have decided to buy a new Pi 2 and give Windows 10 IoT a try with a new project: a running robot that is remotely controlled with a Xbox Controller.
Read More