1. Home
  2. Boost Productivity with Essential Windows Tips & Tricks
  3. Use podman desktop on windows server

Use Podman Desktop on Windows Server

Using containers on Windows Server is a great way to compartmentalize application deployments, and even run apps on other operating systems (like Linux) within Windows Server.

One of the best container apps for Windows Server is Podman Desktop. Podman Desktop was created and developed by RedHat, and it supports Podman, Docker, and many other container technologies. Here’s how to use it on your Windows Server.

Windows Podman Desktop hero image.

Install Chocolatey on Windows Server

The Chocolatey Windows package manager makes installing a lot of applications on Windows Server much easier, as it allows users to run PowerShell commands to get popular applications, rather than dealing with downloading EXE installer files.

The Chocolatey tool will make it much easier to get the Podman desktop app working on your Windows Server. To start, open up a PowerShell window on the Windows Server desktop.

Once the PowerShell window is open and ready to use, run the following command to get the Chocolately package manager set up on your system.

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Once you enter the command above into the PowerShell window, some prompts will appear on the screen. Follow these prompts to get the Chocolatey package manager on your system.

When the Chocolatey package manager is installed on your system, you can test that it works by running the choco command. If nothing happens after you enter it, you’ll need to restart your PowerShell window.

Installing the Podman Desktop app on Windows Server

The Podman Desktop app is quite easy to install on Windows Server now that the Chocolatey package manager is installed. Using the choco install command, set up Podman Desktop.

choco install podman-desktop

The Chocolatey package manager will prompt a few questions while installing Podman Desktop. Follow along with these prompts to get everything working on your system.

Once the Chocolatey app is done installing Podman Desktop, you can close the PowerShell window. Podman Desktop should now be available in the Start Menu.

Enable the Virtual Machine feature on Windows Server

Podman Desktop cannot execute containers on Windows Server without enabling virtualization. To enable this feature, open up a PowerShell window and enter the command below.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

When the command above is executed, you’ll be able to fully utilize Podman Desktop on your Windows Server.

How to create containers in Podman Desktop on Windows Server

Once you’ve successfully installed Podman Desktop on your Windows Server using the Chocolatey package manager, open the application. You can locate Podman Desktop by searching for it in the Windows Server “Start” menu.

With the Podman Desktop app open, you must set up the image “Registries.” “Registries” provide container images, enabling you to quickly download and utilize images to create containers. To begin, click on the gear icon located in the left-hand sidebar to access the options area.

Within the Podman Desktop interface, locate “Registries,” and select it using the mouse. By default, there are four registries set up: “Docker Hub,” “Red Hat Quay,” “GitHub,” and “Google Container Registry.” If you need to log into any of these registries, click “Configure” next to the respective registry, and log into your account.

Note: if you need to add additional container registries to Podman Desktop, click the “Add registry” button, and add your container registry.

After setting up registries in Podman Desktop, open up Notepad in a separate window. You must now write a “Containerfile”. A “Containerfile” is an instruction set that tells Podman Desktop what to do. Here is what a container file looks like.

 # Step 1: Specify Base Image (example: ubuntu:latest)
FROM base-image:tag

# Step 2: Set Metadata (Optional)
LABEL maintainer="maintainer@example.com"

# Step 3: Run Commands
RUN command-to-install-something

# Step 4: Copy Files
COPY ./local-file-path /container-file-path

# Step 5: Set Environment Variables

# Step 6: Expose Ports
EXPOSE port-number

# Step 7: Set Working Directory
WORKDIR /container-directory

# Step 8: Define Command or Entry Point
CMD ["command-to-run", "argument1", "argument2"

For example, if you wish to deploy a basic Apache web server with the latest Ubuntu image, it would look something like this:

# Use the official Ubuntu base image
FROM ubuntu:latest

# Update the package list and install the Apache server
RUN apt-get update && \
    apt-get install -y apache2

# Copy over any necessary files or directories (optional)
# COPY ./public-html/ /var/www/html/

# Expose the port Apache will listen on

# Start the Apache server
CMD ["apachectl", "-D", "FOREGROUND"]

Save the text in Notepad as “Containerfile”. Then, go back to Podman Desktop, and click on the “Create a container” button. After selecting this button, choose “Containerfile or Dockerfile”.

Windows Podman Desktop with container file.

Upon selecting “Containerfile or Dockerfile,” select “Containerfile path,” and browse for the “Containerfile” you made in Notepad earlier. Then, choose where the built image should be saved, and what the image should be named. Finally, click the “Build” button to build your container image in Podman Desktop.

Podman Desktop for Windows is building the container.

The build process will take a second to complete. When the process is finished, find the “Done” button, and select it with the mouse. Upon selecting the “Done” button, Podman Desktop will take you through the process of deploying your container in production.

The Podman Desktop Windows app has built the image and the container is ready to deploy.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.