Getting Started with Ozcode to Debug Docker Microservices

Getting Started with Ozcode and Docker
Getting started with Ozcode to debug Docker microservices is easy. All it takes is 3 quick steps: Sign in, create an app, copy a code snippet. Now, build your container and you're done.

Docker first poked a finger in the eyes of monolithic applications about 10 years ago. Since then, it has become an industry standard for containerized microservices applications. Docker microservices offer many benefits including effective use of IT infrastructure, cross-platform compatibility, easier configuration and maintenance, strong encapsulation, rapid deployment, and more. However, debugging Docker microservices also presents a set of challenges unique to that architecture. Microservices are deployed with redundancy, so when an error occurs, you need to isolate the precise microservice that took part in or manifested the error. Also, an error in functionality may involve code execution across several different microservices, which can be nearly impossible to trace. And then there’s the possibility that you have different versions of the same microservice running at the same time, and you need to understand which of them manifested the error.

Ozcode Production Debugger’s autonomous exception capture traces events leading up to an error across all microservices enabling you to debug Docker microservices with time-travel debug information across the complete error execution flow.

This is the fourth in our series of blog posts that help you get started with Ozcode. Previously, we covered:

The beauty of Docker containers is that they abstract away the underlying operating system so you can write your application in any technology you want, including .NET.

In this post, I’ll show you how to get started with Ozcode to debug a .NET application running as Docker microservices on Linux in 3 easy steps.

  • Step 1: Create or sign in to your account
  • Step 2: Create your application in Ozcode Production Debugger
  • Step 3: Copy a code snippet into your dockerfile

Once an Ozcode agent is running in your container, any exceptions thrown by the container will be recorded through Ozcode’s autonomous exception capture and you can start debugging Docker microservices by tracing the steps back through the error execution flow. I’ll show you how that works after you’ve got Ozcode set up to debug your Docker microservices, and it works just as well whether you’re running your microservices locally or in the cloud.

Step 1: Create or sign in to your account

Sign in to your account by clicking the Launch Debugger - Ozcode  button pretty much anywhere on our website. That will take you to the Production Debugger sign in screen where you can enter your credentials. If you don’t have an account yet, click Sign up and follow the simple cues to verify your email address and you’re ready to go. START FOR FREE- Ozcode

Step 2: Create your application

First time you sign into Ozcode Production Debugger, you will be prompted to create a new application. Otherwise, you can select Add Application under the Applications menu:

Add Application - Ozcode

Either way, once you create your application Ozcode will generate your application token.

Step 3: Copy the code snippet into your dockerfile

Ozcode Production Debugger will also create the code snippet for you to insert directly in your dockerfile:

Code snippet in dockerfile

Note that your application token is already embedded in the snippet.

Now, all you need to do is copy the snippet and paste it into your dockerfile to be built with your base image or into one of the other images in your microservice.

No WGET?

Note that while building the image, the Ozcode agent is downloaded using WGET. If the image in which you included the code snippet doesn’t support WGET, you can simply replace that line with with the following one that uses cURL instead:

curl "https://clouddbgprodstorage.blob.core.windows.net/install/linux/ozcode-pd-agent-linux.tar.gz" > ozcode-pd-agent-linux.tar.gz && \

Alternatively, you can also use apt-get by copying the following command to the top of your dockerfile:

RUN apt-get update && apt-get -f install && apt-get -y install wget

Using Visual Studio?

Visual Studio uses a multi-stage build format to generate Dockerfiles. Therefore, to ensure our snippet gets embedded into the right place in the Dockerfile, insert it after the following line:

FROM base AS final

Now build your image and run the container. You’ll be notified once the agent connects.

Docker Agent Installed - Ozcode

Here’s the whole installation process from start to finish.

Never have to reproduce a production error - Ozcode Now the fun begins.

Start debugging Docker microservices

Whenever your microservice throws an exception, the Ozcode agent catches it and records the complete error execution flow with time-travel debug information. The exception capture is sent back to the server and displayed in your dashboard.
Docker Dashboard - Ozcode

 You can click any error in the dashboard to step through the error execution flow.

Docker Time Travel Debugging - Ozcode

Stay tuned for Tracepoints in Ozcode Production Debugger which will enable you to debug the error execution flow across different microservices.

Ozcode Production Debugger

Automonous exception capture
Don’t chase after exceptions. They automatically appear in your dashboard.

Code-level observability
Get insights into your code down to the deepest levels.

Perfect bug reports
All the data you need is automatically assembled into a single shareable link.

Ozcode Production Debugger - START FOR FREE

Idan Shatz

Comments

Keep your code in good shape!

Subscribe to our blog and follow the latest news in the .NET debugging industry

Ready to Dive into Your Prod Code?

Easy debugging with full time-travel data

The Exception

A Quarterly Roundup

Subscribe to our quarterly newsletter and hear all about what’s happening around debugging with Ozcode

Share on facebook
Share on twitter

Recent Posts

Follow Us

Join Ozcode YouTube Channel

Let’s start debugging, it’s free!

Ozcode Logo

This website uses cookies to ensure you get the best experience on our website.