
Welcome to the course Become a Docker Power User with Visual Studio Code.
I'm your instructor Brian Christner. If you have questions or feedback anytime during the course be sure to add in the comments below.
You can contact me directly on my socials:
Twitter: http://twitter.com/idomyowntricks
LinkedIn: https://www.linkedin.com/in/brianchristner
Outline
Introduction
Docker Desktop and VS Code
Install & Configure VS Code & Docker extension
Power User Mode
Develop inside a container using Remote Containers
Recap
Objectives
Improve your Docker workflow
Bootstrap new Docker Projects
Unlock hidden features
Understand Docker Extension
Power User Mode
In this section, we explore the Visual Studio Code (VS Code) and the Docker extension. We also take a look at the Stack Overflow survey which indicates over 50% of developers prefer VS Code as an IDE.
2019 Stack Overflow Survey - https://insights.stackoverflow.com/survey/2019#development-environments-and-tools
Docker Desktop & VS Code
Docker Desktop and Visual Studio Code integrate seamlessly. With Docker Desktop, it is possible to launch VS Code directly from the Docker Desktop dashboard. Within the dashboard, we can browse available Docker projects managed by Docker Desktop and launch them accordingly.
Requirements to use VS Code & Docker Desktop
Linux, Mac, or Windows
Permission to install Docker & VS Code
Docker installed
Git Installed
Launch Code directly from Terminal Window. Linux & Windows have already installed. Mac please run the command below.
macOS: ⇧⌘P Shell Command: Install 'code' command in PATH
In this section, we present the Docker Desktop & VS Code collaboration capabilities. During the demo, we highlight how to launch VS Code directly from Docker Desktop and from the Terminal.
Install & Configure Overview
Install VS Code
Install VS Code Docker Extension
Interact with Docker Extension
Lab - Install VS Code & Docker Extension
What can you expect from the Docker Extension?
Bootstrap New Docker Projects
Interact with Containers, Images, Volumes, Networks, and Docker Hosts
Write Dockerfiles with code completion
Build & Debug Compose and Dockerfiles
Connect to different Docker Servers
If you already have VS Code installed you can skip this section
In this section, we learn what is required to install VS Code. We will walk through where to get VS Code and the next steps of installation.
Following the installation of VS Code, we can now install the Docker Extension.
Open the VS Code Marketplace
Search for Docker
Install the official Docker Extension
Now that the Docker Extension is installed let's tour the User Interface and Command Palette to understand how to interact with the Docker Extension and access Docker shortcuts.
In the lab, we will walk through installing VS Code, the Docker extension, and interact with the Docker Extension UI & Command Palette.
You can find the Lab resources here - https://github.com/thebyteio/vs-code-docker-training
Let's start unlocking some of the Power User features inside the VS Code Docker Extension. We will start covering all the available features within the Docker Extension and bootstrap our first project without having to write a single line of code.
Overview Power User Mode
Bootstrap a New Project
Lab - Bootstrap Project & Interact with Project
Write Dockerfiles
Lab - Write Dockerfiles
Connect to Docker Hosts
Lab - Docker Context
Recap
In this section, we learn how to bootstrap a Python Flask application. The Docker extension will bootstrap out the project and build the following
Files generated automatically during bootstrap:
vscode docker settings
.dockerignore (to prevent files from being added to Dockerfiles)
Dockerfile (Automatically generates a Dockerfile)
docker-compose.yml (Creates a compose stack for our application)
docker-compose.debug.yml (Will be used in the Debug section)
In the Lab, we will bootstrap a Python Flask application that is a random Cat GIF generator. The Bootstrap process will create a Dockerfile, docker-compose, debug files, and .vscode settings files automatically.
Lab Resource - https://github.com/thebyteio/vs-code-docker-training/blob/master/04-power-user/power-user.md#1-bootstrap-a-new-project
Docker Code Completeion
Now, we will learn how code completion works with the Docker extension. The Docker extension automatically suggests Dockerfile commands and extends this with suggested uses. The command completion can be further expanded to view a link directly to Docker documentation if further clarification is required.
Query Docker Hub
Another amazing feature within the Docker extension is the ability to query Docker hub directly for image names and tags.
TIP
To use command completion or query Docker Hub simply type CTRL + Space
The Dockerfile lab we will walk through how to write a Dockerfile from scratch using Command Completion and Query the Docker Hub directly from VS Code.
We will write a simple Alpine based Mysql image in the Lab.
Alpine is a small Linux distribution.
Lab and Code Samples - https://github.com/thebyteio/vs-code-docker-training/blob/master/04-power-user/power-user.md#5-write-a-dockerfile-with-command-completion
Recap the Power User Mode section which we covered a ton. Now, you can successfully bootstrap projects, Write Docker files with command completion/query Docker Hub, and use Docker Context to connect to Docker Hosts.
Bootstrap a New Project
Lab - Bootstrap Project & Interact with Project
Write Dockerfiles
Lab - Write Dockerfiles
Connect to Docker Hosts
Lab - Docker Context
The Debug feature is one of the most powerful features available inside the Docker Extension. This section we will learn how to configure debug, we will launch our Python Flask demo application in Debug mode, insert breakpoints to help us troubleshoot, and finally troubleshoot and fix our application.
Debug Overview
Overview about Debug
VS Code Configurations
Build & Debug Project
Lab - Debug
Recap
When we bootstrapped our Python application in the Power User section we inherited a couple of new files from VS Code. These files are located in the .vscode folder and container the configurations for launching and running Docker.
The configuration can be adjusted to change the attributes of how Docker builds and run within VS Code. To find out all about the available configurations visit the VS Code configuration documentation.
VS Code Configuration Documentation: https://code.visualstudio.com/docs/containers/reference
This lab will cover:
Break the Demo Application
Launch Debug Mode
Insert Breakpoints and Watch Variables
Fix our Application
Rerun Debug with a healthy application
Lab and Code samples - https://github.com/thebyteio/vs-code-docker-training/blob/master/05-debug-docker/debug-docker-vscode.md
Without any additional code or writing code, we successfully launched Debug, understand how to configure the Docker extension, and the Lab walked us through debugging our broken application.
Recap
VS Code Configurations
Build & Debug Project
Lab - Debug
Unlock new development/debug potential by installing the Remote-Container extension. The Remote-Container extension allows you to connect or launch a container and connect VS Code to the container. This is different than connecting to a Container shell as you have the full development environment inside the container. Additionally, you can control quickly the mounting of files or folders from your host into the container speeding up development time.
Remote-Container Extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
In this section, we quickly walk through how to navigate the Remote - Container extension and how to launch remote containers.
The Lab will walk us through launching a demo application and connect VS Code to this container. We will then interact with the Development container by adding files, folders, and testing.
Lab and Code samples: https://github.com/thebyteio/vs-code-docker-training/blob/master/06-remote-development/remote-dev.md
Resources
VS Code Docs - https://code.visualstudio.com/docs/containers/overview
Awesome VS Code list - https://github.com/viatsko/awesome-vscode
VS Code GitHub - https://github.com/microsoft/vscode-docker
Presentation - https://docs.google.com/presentation/d/1CPkD7-pBppT5rLGFzwSvOjDE3bXzHtJ1EI-wRTssuIs/edit?usp=sharing
theByte DevOps Accelerator
Need help to get your project off the ground? Want to get outside feedback, architecture reviews, or learn how to bootstrap a new project? Then sign-up to theByte coaching - https://www.thebyte.io/cloud-native-devops-accelerator
Cloud-Native Coaching
Architecture Reviews
C-Level feedback for your projects
How to bootstrap your projects
How to structure new tech project workshops
Group Calls
Course Announcements
Lifetime Course access
Any course updates we will send out announcements
Course updates / new features / new uses cases
New Sections will continue being added/updates
Completion Certificate
Please fill out the survey to receive your Completion Certificate
Be sure to share your certificate on Twitter, Facebook, LinkedIn and tag me as I will reshare your awesome achievement
Fill out this quick survey (less than 2 minutes) to request your certificate: https://form.typeform.com/to/e2hkccCl
Connect with me
Brian Christner
brian@thebyte.io
Founder theByte.io
Twitter: https://twitter.com/idomyowntricks/
LinkedIn: https://www.linkedin.com/in/brianchristner/
Learn how to improve your Visual Studio Code Workflows, Unlock Features, Save Time, and become a Docker Power User.
This course will teach you the skills you need to use VS Code and the Docker extension. It is based upon direct collaboration between Microsoft and Docker to provide excellent knowledge about VS Code and Docker alike.
VS Code is the world's most popular development tool according to a recent Stack Overflow survey. Combing VS Code with Docker unleashes new workflows, reduces context switching, and enables you to become a Docker Power User at the same time.
The Instructor Brian Christner is a Docker Captain, Open Source Contributor, and DevOps engineer with real-world experience.
Some of the benefits you will take away from the course:
Unlock VS Code Shortcuts
Improve your Docker & VS Code workflows
Reduce context switching when developing with Docker & VS Code
Bootstrap new Docker projects without writing a single line of code
Learn to Debug your Docker projects
Enable Remote Development to initialize VS Code inside containers
Become a Docker Power User!!