Using Power Platform CLI with Podman

Docker has always been my go-to tool for Dev Containers. I still use it on my personal machine, but when it comes to work machine I cannot use it without buying a subscription because of the licensing terms below.

Docker Desktop remains free for small businesses (fewer than 250 employees AND less than $10 million in annual revenue), personal use, education, and non-commercial open source projects.
It requires a paid subscription (Pro, Team or Business), starting at $5 per user per month, for professional use in larger businesses. You may directly purchase here, or share this post and our solution brief with your manager.

While I could technically deal with this internally, switching to Podman is easier than raising a ticket and getting the required approvals due the effort and time required. Podman license also permits commercial use.

If you try to use feature in devcontainer.json however, you would get the error below

Screenshot of terminal error when using features with Podman

This is because unlike Docker, Podman runs in a rootless container and so it cannot install the tools needed as a restricted user. I have also added my experience to this issue on Podman repo -> https://github.com/containers/podman/issues/17313

There are two ways to over come this:

  1. Don’t use features. Install the tools needed on the Docker file
  2. Build the devcontainer.json file using Dev Containers CLI and publish the image to Docker Hub or any container registry. Use this image on a new devcontainer.json. Since you cannot build the image with Podman (due to the features limitation) better to use Docker to build this, or do this in GitHub Actions

Before you start using Podman make sure you update this user setting on your VSCode so that VSCode runs Podman to spin up the Dev Container.

Screenshot that shows VSCode user setting for Podman

You can access the sample repo at https://github.com/rajyraman/podman-pac

There are multiple Dockerfiles in this repo.

  1. .devcontainer/docker/devcontainer.json – This is the file you would normally use if you have Docker installed
  2. .devcontainer/podman/devcontainer.json – This is the file to use if you want to build the image using the local Dockerfile with Podman. This devcontainer.json does not use any features at all.
  3. .devcontainer/prebuilt/devcontainer.json – This is the file that uses the Power Platform CLI image published on Docker Hub

If you are using GitHub Codespaces you can also prebuild the image, so that your don’t need to wait a lot when the wheels start spinning.

Screenshot from GitHub that shows prebuild config

I hope that this helps people who use Dev Containers with Podman.

Repo: https://github.com/rajyraman/podman-pac/

Docker Hub: https://hub.docker.com/repository/docker/rajyraman/powerplatformcli/

Leave a comment