Is "Enable Docker" in VS project creation only adding the docker files or is there more magic to it?

Viewed 206

While creating a new project, there's the option to Enable Docker as depicted below. I've used containers for a while and set up my docker files manually, not as a part of any template. In fact, that's how I've taught myself once, looong time ago, and, frankly, never even thought of an alternative.

enter image description here

I'm currently setting up a new project and I'm not sure what precisely (and I mean nerdly, academically precisely) that checkbox does to my creation. Googling the matter (proof of effort in links below) gave me a lot of great info but not the actual answer to whether the addition of the docker container definition actually is the only deviation from the usual template based project. It maybe is there and I'm simply to dense to realize it. Feel free to smack me in the back of my head if so is the case.

MSDN on containers
MSDN on docker support in VS
C# corner on general docker approach in VS
Blog on practical considerations
Example of (one of several) unrelated SO posts

1 Answers

I feel this is a very valid question, but without a very specific answer as provided by the OP.

I would like to extend this to container tools not be specific to docker. Docker will be used as an example.

I feel the answer is already answered here(provided by OP) -> https://docs.microsoft.com/en-us/visualstudio/containers/overview?view=vs-2019

The tools included in Visual Studio for developing with containers are easy to use, and greatly simplify building, debugging, and deployment for containerized applications. You can work with a container for a single project, or use container orchestration with Docker Compose, Service Fabric, or Kubernetes to work with multiple services in containers.

It does not only add the dockerfiles. We are getting other capabilities as well most probably specific to Visual Studio which allow for building and debugging with the aka F5 experience as mentioned above. Also, we can append to it with orchestrators such as Docker-Compose, Service Fabric and Kubernettes again with building and debugging capabilities with F5.

As it can be seen very quickly by the below image, by just creating & enabling docker and docker compose orchestration support I am able to start the application using docker compose with F5 and also I have debugging capabilities out of the box. Also I can append to it with other services and add to the orchestrator with auto gen tools. Visual studio for most of these things will prompt to the user and it will fill Dockerfile and docker-compose files automatically. So we do not have to write any of the boilerplate infrastructure code.

There is some difference in the templates, not really though, since you can add docker & orchestration support later in the project with some extra clicks. So you do not have to do it from the start

enter image description here

Related