Visual Studio (code) tools for docker
Alessandro Melchiori - @amelchiori
CodicePlastico
Agenda
Docker and
Docker-Compose
Docker is a very popular container platform that lets you easily package, deploy,
and consume applications and services.
With Docker, you can build images by specifying the step by step commands needed to build the image
in a Dockerfile. A Dockerfile is just a text file that contains the build instructions.
Docker
What’s a container?
Instead of configuring a machine to host your
application, you have your application wrapped
into a container and deployed on a machine that
hosts the container engine which is in charge of
actually running the containers.
The Docker extension
Docker support for VS Code is provided by an
extension.
To install the Docker extension, open the
Extensions view by pressing Ctrl+Shift+X and
search for docker to filter the results. Select the
Microsoft Docker extension.
DEMO
Create a Dockerfile
Multi-stage builds are a new feature requiring Docker 17.05 or higher on the daemon and client. Multistage
builds are useful to anyone who has struggled to optimize Dockerfiles while keeping them easy to read and
maintain.
Docker multi-stage builds
Docker multi-stage builds
> FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
> WORKDIR /app
> COPY *.csproj ./
> RUN dotnet restore
> COPY . ./
> RUN dotnet publish -c Release -o out
> FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
> WORKDIR /app
> COPY --from=build-env /app/out .
> ENTRYPOINT ["dotnet", "aspnetapp.dll"]
DEMO
Create a Dockerfile using vscode extension
Developing inside
a container
The Remote - Containers extension lets you use a Docker container as a full-featured development
environment. Whether you deploy to containers or not, containers make a great development environment
because you can:
● Develop with a consistent, easily reproducible toolchain on the same operating system you deploy to.
● Quickly swap between different, isolated development environments and safely make updates without
worrying about impacting your local machine.
● Make it easy for new team members / contributors to get up and running in a consistent development
environment.
● Try out new technologies or clone a copy of a code base without impacting your local setup.
Remote containers extension
Developing inside a container
Workspace files are mounted from the local file
system or copied or cloned into the container.
Extensions are installed and run inside the
container, where they have full access to the
tools, platform, and file system.
This means that you can seamlessly switch your
entire development environment just by
connecting to a different container.
Kubernetes
integration
Kubernetes is a cluster technology.
It means that you will see a cluster of computers
as one entity. You will not deploy an application
on a specific computer, but somewhere in the
cluster
What’s Kubernetes (k8s)
K8s 101 - Nodes
Each computer in the cluster is called a node.
Eventually, the nodes will host your applications.
The nodes can be spread throughout the world in
different data centers
K8s 101 - Pods
Pods are the smallest unit you will eventually
deploy to the cluster.
A single Pod can hold multiple containers.
K82 101 - Deployments
Deployments are requirements you give to
Kubernetes regarding your applications (Pods)
K8s 101 - Services
Services are an abstract way to expose an
application running on a set of Pods as a
network service.
DEMO
K8s deployment configuration
ALESSANDRO MELCHIORI
Founder & Software developer @CodicePlastico
alessandro@codiceplastico.com
@amelchiori
Grazie!

VS Code tools for docker

  • 1.
    Visual Studio (code)tools for docker Alessandro Melchiori - @amelchiori CodicePlastico
  • 2.
  • 3.
  • 4.
    Docker is avery popular container platform that lets you easily package, deploy, and consume applications and services. With Docker, you can build images by specifying the step by step commands needed to build the image in a Dockerfile. A Dockerfile is just a text file that contains the build instructions. Docker
  • 5.
    What’s a container? Insteadof configuring a machine to host your application, you have your application wrapped into a container and deployed on a machine that hosts the container engine which is in charge of actually running the containers.
  • 6.
    The Docker extension Dockersupport for VS Code is provided by an extension. To install the Docker extension, open the Extensions view by pressing Ctrl+Shift+X and search for docker to filter the results. Select the Microsoft Docker extension.
  • 7.
  • 8.
    Multi-stage builds area new feature requiring Docker 17.05 or higher on the daemon and client. Multistage builds are useful to anyone who has struggled to optimize Dockerfiles while keeping them easy to read and maintain. Docker multi-stage builds
  • 9.
    Docker multi-stage builds >FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env > WORKDIR /app > COPY *.csproj ./ > RUN dotnet restore > COPY . ./ > RUN dotnet publish -c Release -o out > FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 > WORKDIR /app > COPY --from=build-env /app/out . > ENTRYPOINT ["dotnet", "aspnetapp.dll"]
  • 10.
    DEMO Create a Dockerfileusing vscode extension
  • 11.
  • 12.
    The Remote -Containers extension lets you use a Docker container as a full-featured development environment. Whether you deploy to containers or not, containers make a great development environment because you can: ● Develop with a consistent, easily reproducible toolchain on the same operating system you deploy to. ● Quickly swap between different, isolated development environments and safely make updates without worrying about impacting your local machine. ● Make it easy for new team members / contributors to get up and running in a consistent development environment. ● Try out new technologies or clone a copy of a code base without impacting your local setup. Remote containers extension
  • 13.
    Developing inside acontainer Workspace files are mounted from the local file system or copied or cloned into the container. Extensions are installed and run inside the container, where they have full access to the tools, platform, and file system. This means that you can seamlessly switch your entire development environment just by connecting to a different container.
  • 14.
  • 15.
    Kubernetes is acluster technology. It means that you will see a cluster of computers as one entity. You will not deploy an application on a specific computer, but somewhere in the cluster What’s Kubernetes (k8s)
  • 16.
    K8s 101 -Nodes Each computer in the cluster is called a node. Eventually, the nodes will host your applications. The nodes can be spread throughout the world in different data centers
  • 17.
    K8s 101 -Pods Pods are the smallest unit you will eventually deploy to the cluster. A single Pod can hold multiple containers.
  • 18.
    K82 101 -Deployments Deployments are requirements you give to Kubernetes regarding your applications (Pods)
  • 19.
    K8s 101 -Services Services are an abstract way to expose an application running on a set of Pods as a network service.
  • 20.
  • 21.
    ALESSANDRO MELCHIORI Founder &Software developer @CodicePlastico alessandro@codiceplastico.com @amelchiori
  • 22.