Skip to content

Instantly share code, notes, and snippets.

Rich Lander richlander

Block or report user

Report or block richlander

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size

richlander /
Last active Oct 25, 2019
.NET Core 3.0 -- Post Launch Blog Posts

.NET Core 3.0 -- Post Launch Blog Posts

We launched .NET Core 3.0! Go team! The super official blog post covered a lot of features, but none of them at depth. Many people will want to learn more about specific scenarios at features at much greater depth, with more guidance and better code samples.

The following is a list of proposed posts (with descriptive but prelimary titles) for us to write and publish during the rest of 2019.

Note: This tweet also has feedback.

Getting Started

richlander /
Created Jul 23, 2019
.NET Core 3.0 SDK Size Improvements

.NET Core 3.0 SDK Size Improvements

The .NET Core SDK is significantly smaller with .NET Core 3.0. The primary reason is that we changed the way we construct the SDK, by moving to purpose-built “packs” of various kinds (reference assemblies, frameworks, templates). In previous versions (including .NET Core 2.2), we constructed the SDK from NuGet packages, which included many artifacts that were not required and wasted a lot of space.

The following sections demonstrate the size improvements for Windows, Linux and macOS, including container delivery. They detail the process and commands that were used to determine the product sizes, enabling you to reproduce the same results in your own environment. To keep thing simple, zips and tar balls were downloaded from dotnet/core-sdk as opposed to the official installers.

Some readers will be shocked on how large the .NET Core 2.2 installer directory grows when the NuGetFallback archive is expanded to the NuGetFallBackFolder. W

richlander / Dockerfile
Last active Oct 11, 2019
.NET Core 3.0 Preview 3 Dockerfile
View Dockerfile
FROM AS base
FROM AS build
COPY ["WebApplication4/WebApplication4.csproj", "WebApplication4/"]
RUN dotnet restore "WebApplication4/WebApplication4.csproj"
COPY . .
richlander /
Last active May 11, 2019
Inspect MCR Registry Tags for .NET Core

Inspect MCR Registry Tags for .NET Core

This workflow explores the 3.0 manifest-based tag in the repo on MCR as an example. It uses curl to call a set of container registry APIs to find image digests, layer digests, and layer location. This example is intended to show the separation between MCR as a image manifest service and Azure CDN as an image layer service.

This pattern can be used on any operating system, but the specific commands are OS-specific. curl is included in the latest versions of Windows and is also in most Linux and macOS distributions. findstr is part of Windows, however, grep can be used on Linux or macOS instead.

Inspect Manifest tag

The 3.0 tag is a manifest tag. It represents a set of potential candidate images, for various operating systems and operating systems versions. When a manifest tag is pulled by a docker client, the client picks the best image for the host op

richlander / Program.cs
Last active Jan 22, 2020
Environment information
View Program.cs
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using static System.Console;
namespace versioninfo
class Program
richlander / json-document.cs
Created Jan 29, 2019
Sample Usage of JsonDocument and JsonElement
View json-document.cs
static double ParseJson()
const string json = " [ { \"name\": \"John\" }, [ \"425-000-1212\", 15 ], { \"grades\": [ 90, 80, 100, 75 ] } ]";
double average = -1;
using (JsonDocument doc = JsonDocument.Parse(json))
JsonElement root = doc.RootElement;
JsonElement info = root[1];
richlander / skeleton-ibufferwriter-impl.cs
Created Jan 29, 2019
Skeleton IBufferWriter<byte> Implementation
View skeleton-ibufferwriter-impl.cs
public class ArrayBufferWriter : IBufferWriter<byte>, IDisposable
private byte[] _rentedBuffer;
private int _written;
public ArrayBufferWriter(int initialCapacity)
// TODO: argument validation
_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity);
richlander / json.cs
Created Jan 29, 2019
Sample usage of Utf8JsonWriter
View json.cs
static int WriteJson(IBufferWriter<byte> output, long[] extraData)
var json = new Utf8JsonWriter(output, state: default);
json.WriteNumber("age", 15, escape: false);
json.WriteString("date", DateTime.Now);
json.WriteString("first", "John");
json.WriteString("last", "Smith");
richlander / SoftwareFallback-take-pointer.cs
Created Jan 29, 2019
Taking pointer from unmanaged constructed type
View SoftwareFallback-take-pointer.cs
Vector256<int> SoftwareFallback(int x)
var result = Vector256<int>.Zero;
((int*)(&result))[0] = x;
return result;
You can’t perform that action at this time.