Skip to content

Instantly share code, notes, and snippets.

@hardyscc
Last active June 18, 2024 07:09
Show Gist options
  • Save hardyscc/97b5310233a9c8f3d9ba0b1b6ba0144e to your computer and use it in GitHub Desktop.
Save hardyscc/97b5310233a9c8f3d9ba0b1b6ba0144e to your computer and use it in GitHub Desktop.
Podman on Windows

Podman on Windows

Prerequisite

  1. Windows Subsystem for Linux

    • First ensure Windows Subsystem for Linux has been installed under System > Optional features > More Windows features.
  2. OpenSSH

    winget install Microsoft.OpenSSH.Beta

    only needed if you don't have ssh-keygen on your path

Installation

winget install RedHat.Podman
winget install RedHat.Podman-Desktop

Setup

  1. Create Podman Machine

    • Open Podman Desktop > Dashboard
    • Click Set up under the Notification
    • Follow all the steps to create a Podman Machine
  2. Add registry

    • Goto Settings > Registries > Add registry
    • Registry Location: registry.domain:5000 with your username and password
  3. Setup Proxy

    • Goto Settings > Proxy
    • Enable proxy configuration
    • Set http://username:password@proxy.ha.org.hk:8080 into both HTTP & HTTPS
    • Set registry.domain:5000 into no proxy
    • Press Update to apply
  4. Restart your Podman Machine

    • Goto Settings > Resources > Podman Machine
    • Press the restart button
  5. Verify your setup

    podman run -it --rm alpine echo success

    for some unknown reason, you may need to restart the podman machine again few times to make sure the proxy is taking effect.

Add insecure registry

  1. Shell into Podman Machine and edit registries.conf

    podman machine ssh
    > sudo vi /etc/containers/registries.conf
  2. Append the following to the end of file

    [[registry]]
    location = "registry.domain:5000"
    insecure = true
  3. Finally restart the Podman Machine

    • Goto Settings > Resources > Podman Machine
    • Press the restart button

You can now use podman to replace docker.

Install Kind Extension (Optional)

Goto Settings > Resources > Kind

  • Click the Create new ..., in the next page then press Create button.

Teardown

podman machine stop
podman machine rm

winget uninstall RedHat.Podman
winget uninstall RedHat.Podman-Desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment