Skip to content
  1. We help small teams achieve big things.
  2. Our Technical Fellow just became a Microsoft MVP!
  3. We run the Azure Weekly newsletter.
  4. We just won 2 awards.
  5. We just published Programming C# 8.0 book.
  6. We run the Power BI Weekly newsletter.
  7. Our NDC London 2020 is now available online!
  8. We are school STEM ambassadors.
Mike Larah By Mike Larah Software Engineer II
Setting up Porter on Windows

Porter is a tool based on the CNAB (Cloud Native Application Bundle) spec. It can be used for building, managing, and installing application bundles.

The official Porter documentation has an installation guide for the different OS platforms, however in this guide I will explain how to install the pre-requisites (i.e. Docker) and verify that everything is installed correctly, for Windows specifically.

Installing Docker

By default, Porter requires a local instance of the Docker Engine daemon in order to build and install bundles. There are other drivers available for installing bundles (such as the Azure driver), and a feature to add custom drivers for building bundles is currently being worked on, but we won't go into details in this post - we will assume that we will be using the default Docker drivers.

(Note - originally I was unable to get Porter running without using the WSL 2 tech preview for Docker. However, I found that this is no longer the case - I never figured out whether it was something wrong in my setup or something that updated in Docker. If you are interested in how to set up WSL 2 for Docker, see my other post.)

You can install the Docker Engine daemon by installing Docker for Windows. Follow the setup instructions and then verify that the installation was successful and that the Docker daemon is running by executing

docker --version

in a PowerShell or cmd terminal.

You can also run

docker run hello-world

to verify that you can successfully pull down an image from Docker Hub and run a container from that image.

Installing Porter

Now that Docker is installed, we can install and use Porter itself.

To install the latest version of Porter, run the following PowerShell command, which will download and run the Windows installation script for Porter:

This will install the Porter tool and the default set of mixins (exec, kubernetes, helm, azure, terraform, az, aws, gcloud). At the end of the installation, it will show you a command to run to add the porter tool directory to your PATH:

$env:PATH+=";$env:USERPROFILE\.porter"

However, this will not persist between PowerShell sessions. If you want to update the PATH permanently, run the following command (after running the previous command):

You can now test that you have installed Porter correctly by running:

porter version

This should output the current version of porter that you have installed

Finally, let's test that Porter is working correctly with Docker for building and installing bundles.

In an empty directory, run the following to setup a 'hello world' Porter example:

porter create

If you look, you'll see this has created you a Porter manifest (porter.yaml) and other associated files.

To build the bundle, run:

porter build

If everything is setup correctly, this should successfully build the invocation image using docker, and a .cnab folder with a bundle.json file should be created.

Now to test the bundle can install, run:

porter install

This will use Docker to run the invocation image, and you should see the same output as below.

And that is everything set up correctly. You can now develop, build, and install Porter bundles using your Windows machine.

Mike Larah

Software Engineer II

Mike Larah

Mike is a Software Engineer at endjin with almost a decade of experience in solving business problems with technology. He has worked on a wide range of projects for clients across industries such as financial services, recruitment, and retail, with a strong focus on Azure technologies.