Containers and Docker
- Docker is an app (open source, Docker Inc is a company).
- Docker and Containers are not the same, Docker provides a more usable way to manage Containers, without Docker it is very difficult but it can be done.
- Docker is not the only Container management software but it is the most popular.
- Docker reads Docker files. The Docker files contain instructions on how to run Containers.
- An Image is the signature of the Container, the Container is the instance/running image.
- Containers are applications. These applications need somewhere to run, they run in an Operating System provided by the Cloud of your choice e.g. Azure or AWS.
- Containers can contain any applications and Containers can run other Containers. You can build up complex Containers using other Containers.
- Containers are lightweight and start up very fast, quicker than VMs as they do not have their own OS.
- DockerHub is a store where you can get other Containers.
- Docker Containers are Stateful i.e. the can be shutdown and restarted and will still have the data. This also means that Databases can be ran inside Docker Containers.
Resources
Docker Get Started https://docs.docker.com/get-started/
Docker Cheat Sheet https://dockercheatsheet.painlessdocker.com/
Docker Containers Big Picture https://app.pluralsight.com/library/courses/docker-containers-big-picture/table-of-contents
Containers
Containers do not have their own Operating System, this makes them lighter than a Virtual Machine
Windows Containers are slightly slower and more complicated than Linux containers, because the Windows Container requires additional Processes to run, which Linux does not.
Image vs Container
A Container can be made up of many Images, stacked one on top of the other. These do not persist data by default, meaning that no matter how many times you create a Container from an Image it will always be the same Container. However if you wish to persist data to the a new Image then you can use the docker commit command, this creates a new Image with your data, the data resides in a Layer on top of the others.
.NET Containers
.NET Core vs .NET Framework https://stackify.com/net-core-vs-net-framework/
Use .NET Core instead of .NET Framework for Containers. .NET Core does not have UI's either Windows or WebForms, it does support a command line.
ASP.NET MVC apps can be, apparently, converted to Docker Images and then Docker Container, https://docs.microsoft.com/en-us/aspnet/mvc/overview/deployment/docker-aspnetmvc
Windows Services to Docker Containers with .NET Core https://stackify.com/creating-net-core-windows-services/
Converting .NET applications to a Docker Container
.NETStandard .NET Core or .NET Framework
- .NET Core made .NET available on other OSs.
- .NET Core still does not cover all that was in .NET Framework.
- .NETStandard is the real bare bones .NET and is supported on all OSs that support .NET.
- Use .NETStandard where possible, then .NET Core and finally as a last resort .NET Framework libraries which may or may not work.
- Move all common class libraries to .NETStandard.
- Move all Services to .NET Core.
- Move all UIs to .NET Core and pull in all of the other dependencies individually.
https://msdn.microsoft.com/en-us/magazine/mt842506.aspx
.NET Standard is a specification of APIs that all .NET implementations must provide. It brings consistency to the .NET family and enables you to build libraries you can use from any .NET implementation. It replaces PCLs for building shared components..NET Core is an implementation of the .NET Standard that’s optimized for building console applications, Web apps and cloud services using ASP.NET Core. Its SDK comes with a powerful tooling that in addition to Visual Studio development supports a full command line-based development workflow. You can learn more about them at aka.ms/netstandardfaq and aka.ms/netcore.
https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/
https://stackify.com/creating-net-core-windows-services/

Testing Containers
Install Docker on a VM, Linux or Windows server.
OR
Install on your local Windows box with Docker for Windows (Windows 10, Windows Server 2016) https://docs.docker.com/docker-for-windows/install/ (I had to restart my Windows 10 machine twice in order for the Docker app to initially start correctly ).
Docker Registry
DockerHub is number one.
This are webservices that allow anyone to store Docker Containers. These Containers are then available to all or some (Repos can be used to privatice) a to use.
Inside the Corporate firewall you can use an internal Registry like Docker Trusted Registry DTR (not free) to store Containers.https://docs.docker.com/datacenter/dtr/2.4/guides/
Docker Container Development Flow
.NET Standard is a specification of APIs that all .NET implementations must provide. It brings consistency to the .NET family and enables you to build libraries you can use from any .NET implementation. It replaces PCLs for building shared components.
.NET Core is an implementation of the .NET Standard that’s optimized for building console applications, Web apps and cloud services using ASP.NET Core. Its SDK comes with a powerful tooling that in addition to Visual Studio development supports a full command line-based development workflow. You can learn more about them at aka.ms/netstandardfaq and aka.ms/netcore.
AWS
EC2, the cloud instance.
ECS, Container Management Service, a service to manage many EC2s and makes manage Docker itself.
Docker and Azure
Docker Containers allow you to wrap your application up into a self contained application what requires nothing from the outside environment. This leads to a much safer deployment as your app is guaranteed to have all of the dependencies it needs and work exactly as it did in the developers workspace.
https://channel9.msdn.com/Series/Docker-for-NET-Developers
The video link above is series of videos which explains all. Below are some of the technologies mentioned throughout the videos.
NGINX (engine x)
A webserver which hides your real servers and allows you to easily manage load on your real servers.Redis
A NoSQL database which stores the date in memory (very fast). Commonly used to store name/value pairs for use by multiple servers on one machine e.g. In the Cloud or Docker you could use Redis to store common variables so that all your containers have access to the same data.Kestral
Message Queue, used by Docker, is required by Docker.DNX
DotNet Execution Environment.Allows .NET programs to run without Windows. The DNX contains all you need and pulls in dependencies using NuGet.
DNX was part of .NET and .NET Core.
Docker CLI
Command line for Docker. Download the Docker Client onto your development machine and execute commands which will communicate with the Docker Server.Docker Image
A text file containing the definition for the Docker Container.Docker Container
The instance created by Docker based on the contents of the Docker Image file.Docker Hub
A place where you can get Docker Images created by other users.Can be accessed from the website, through an API in code or through other Docker Image files.
Mono
An alternative to the Microsoft .NET Framework, it's open source..NET Framework for Windows, Linux and Mac.
.NET Core
Not the full .NET Framework, just enough to run .NET applications..NET CLI
This is the specification for the .NET Framework. Used by others including Mono to write alternatives to Microsoft .NET Framework.Windows Server Containers
Standalone processes hosted on Windows Server.HyperV Containers
Standalone processes hosted on Windows Server but with a bit more security. Useful where multiple Containers belonging to more than 1 company are hosted on same Server.Docker Compose
Tool for defining and running multiple Docker Containers.Docker Swarm
Docker Container management tool.
Manage Docker Containers. Manage the network connections between containers.
Kubernetes
Docker Container management tool.dnu.cmd
.NET Development Utilities.Part of DNX. Command line tool. Manages dependencies using NuGet.
TLS
Security at the Transport layer. Super-ceded by SSL.Azure Endpoint
.....Curl
Linux command to send and receive date over the web, supports all of the protocols like HTTP.Powershell.
Comments