For my 2-day Docker and Kubernetes virtual classes, I use DigitalOcean as the cloud provider because it's very easy to use and I can provide my students with a $100 usage credits using a referrer link.  I provide them with a list of software to install, most installable on Windows using the Chocolatey package manager but DigitalOcean does not have one so I thought I'd fix that.

I first looked at the Chocolatey documentation saying to myself, how hard can this be?  Well, after a couple of hours fiddling around I quit miserably and full of shame.  The problem I found is the doc is complete but it's so intimidating.  It's like learning a new language by reading a dictionary.  You get all the words but you don't known how to put them into sentences.

Inspired by the great Commander Peter Quincy Taggart saying "Never Give Up Never Surrender", I tried again a couple of weeks later.  Turns out that once you get rid of the non necessary comments and commands stuffed into the default choco project files, it's quite simple.

You need to edit the [packagename].nuspec file and fill the metadata info: 

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="">
    <owners>Guy Barrette</owners>
    <!-- This section is about the software itself -->
    <!-- projectUrl is required for the community feed -->
    <copyright>2020 DigitalOcean</copyright>
    <tags>doctl digitalocean</tags>
    <summary>doctl is a command line interface for the DigitalOcean API</summary>
    <description>doctl enables you to manage your DigitalOcean resources from the command line.  64bit only.</description>
    <file src="tools\**" target="tools" />

Next, you need to get the download link and sha256 checksum of the tool you want to install.  In my case I got the info from the release section of the doctl repo in the DigitalOcean GitHub account:

Edit the chocolateyinstall.ps1file and at the minimum, provide these info to the correct command.  In this case, since the repo provides a zipped version, I had to use the Install-ChocolateyZipPackage command to unzip the file.

$ErrorActionPreference = 'Stop';
$toolsDir   = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$url           = ''
$checksum64    = '9c7231dcd36afed12c1c9404e30d820523f327d4e732b0ff6dd0908ebcfd9c83'
$checksumType64= 'sha256'

Install-ChocolateyZipPackage $env:ChocolateyPackageName $url $toolsDir -checksum64 $checksum64 -checksumType64 $checksumType64

At the Terminal type create the package using:

choco pack

You can test it locally using:

choco install doctl -dv -s .

When done testing, provide your Chocolatey API key:

choco apikey --key [yourKey] --source

And finally, push the package:

choco push [package].nupkg --source

And now for the excruciating part, you have to wait until a human being validates your package and that can take from a few days to a few months!

Here's the link for the doctl package:

The code is on GitHub:

Next Winget? 🤔

Learn Docker and Kubernetes

Like this blog post? I also teach Docker and Kubernetes online virtual classes at Kubernetes Academy.

Kubernetes Academy offers instructor led training workshop-style on Docker containers and Kubernetes for web developers, DevOps specialists, I.T. Pros.

Courses info, dates and prices:

20% OFF Discount Code: GUYB-BLOG