Mastering Docker Enterprise
上QQ阅读APP看书,第一时间看更新

Containerizing and testing the PoC application on a Dev workstation

Entire books have been written about containerizing applications and, in fact, we will discuss one such book later in this section. Containerization is probably one of the most challenging areas for organizations as they work through a PoC, and is therefore a great place to get some help if you are brand new to containers. Docker Inc and MTA enabled Docker Authorized partners have entire service offerings dedicated to the PoC process, and most of their expertise is applied to the application containerization section. However, assuming you are reading this book in an effort to work through this on your own, I will do my best to present a clear process, as well as supporting material from Docker experts.

Image2Docker is a tool designed to help teams containerize applications from VHD or WIM files. If your target application is packaged in a VM, this can help to get you started, but it is not magic. To run the tool, install Docker and the Docker2Image PowerShell 5 module on a Windows box. Then, run the application against the VHD or WIM file to generate Dockerfile. While the tool can be helpful as you get started, there are some limitations.

Also, the Docker professional services team and MTA-enabled Docker Partners have a more powerful version of this tool called the Docker Application Converter ( DAC). They will use it to scan servers and create initial Dockerfiles for Windows and Linux applications. These initial files are refined and refactored for the PoC.

More information on Image2Docker can be found at  https://github.com/docker/communitytools-image2docker-win.

Your goal in this section is to create a containerized PoC application that can be deployed to the Docker PoC cluster we created in the previous section. While the PoC application could be any custom application that targets Windows or Linux, for our PoC, we will demonstrate the process using a .NET web application with a SQL Server database. Java and JavaScript fans, don't despair! In Chapter 4, Prepare the Docker Enterprise Pilot Cluster, when we get into the pilot phase, we will use a Java book application with a React frontend as our example.

For our PoC application, we will follow this process for containerization:

  • Review the application documentation
  • Containerize each application component/process into an image
  • Test each containerized image locally
  • Create a deployment file app and test it locally
  • Push images
  • Test deploy on the Docker Enterprise PoC platform
  • Review with the team

Our sample .NET application featured in the PoC is from a Docker blog by post by Elton Stoneman. We chose this application from Elton because he's a Docker expert and he provides in-depth additional material, including his blog (https://blog.docker.com/2018/02/video-series-modernizing-net-apps-developers/) and his related book (https://www.packtpub.com/virtualization-and-cloud/docker-windows). 

The GitHub repository for the PoC sample is here: https://github.com/dockersamples/mta-netfx-dev/tree/part-1.