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.
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
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.
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:
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:
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:
If you look, you'll see this has created you a Porter manifest (porter.yaml) and other associated files.
To build the bundle, run:
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:
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.