<script>!function(){functiont(t){document.documentElement.setAttribute("data-theme",t)}vare=function(){try{returnnewURLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{returnlocalStorage.getItem("theme")}catch(t){}}();null!==e?t(e):window.matchMedia("(prefers-color-scheme: dark)").matches?t("dark"):window.matchMedia("(prefers-color-scheme: light)").matches?t("light"):t("dark")}(),function(){try{constc=newURLSearchParams(window.location.search).entries();for(var[t,e]ofc)if(t.startsWith("docusaurus-data-")){vara=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><divid="__docusaurus"><divrole="region"aria-label="Skip to main content"><aclass="skipToContent_oPtH"href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><navaria-label="Main"class="navbar navbar--fixed-top"><divclass="navbar__inner"><divclass="navbar__items"><buttonaria-label="Toggle navigation bar"aria-expanded="false"class="navbar__toggle clean-btn"type="button"><svgwidth="30"height="30"viewBox="0 0 30 30"aria-hidden="true"><pathstroke="currentColor"stroke-linecap="round"stroke-miterlimit="10"stroke-width="2"d="M4 7h22M4 15h22M4 23h22"></path></svg></button><aclass="navbar__brand"href="/"><divclass="navbar__logo"><imgsrc="/img/logo.svg"alt="Podman Desktop Logo"class="themedComponent_siVc themedComponent--light_hHel"height="56"><imgsrc="/img/logo.svg"alt="Podman Desktop Logo"class="themedComponent_siVc themedComponent--dark_yETr"height="56"></div><bclass="navbar__title text--truncate">podman desktop</b></a><aaria-current="page"class="navbar__item navbar__link navbar__link--active"href="/docs/intro">Documentation</a><aclass="navbar__item navbar__link"href="/core-values">Core Values</a><aclass="navbar__item navbar__link"href="/features">Features</a><aclass="navbar__item navbar__link"href="/downloads">Downloads</a><aclass="navbar__item navbar__link"href="/extend">Extend</a><aclass="navbar__item navbar__link"href="/blog">Blog</a></div><divclass="navbar__items navbar__items--right"><ahref="https://github.com/containers/podman-desktop"target="_blank"rel="noopener noreferrer"class="navbar__item navbar__link header-github-link"></a><divclass="toggle_ki11 colorModeToggle_Hewu"><buttonclass="clean-btn toggleButton_MMFG toggleButtonDisabled_Uw7m"type="button"disabled=""title="Switch between dark and light mode (currently dark mode)"aria-label="Switch between dark and light mode (currently dark mode)"aria-live="polite"><svgviewBox="0 0 24 24"width="24"height="24"class="lightToggleIcon_lgto"><pathfill="currentColor"d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svgviewBox="0 0 24 24"width="24"height="24"class="darkToggleIcon_U96C"><pathfill="currentColor"d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51zM12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.
<p>Podman Desktop uses when clauses to enable or disable extensions command and UI customizations, such as views.</p>
<p>For example, the Kind extension adds a custom icon to a container that has a label equals to <code>io.x-k8s.kind.cluster</code> by using the following instruction.</p>
<p>A when clause can consist of a context key (such as <code>isLinux</code>) or complex expressions to define a specific state.</p>
<h3class="anchor anchorWithStickyNavbar_JmGV"id="available-context-keys">Available context keys<ahref="#available-context-keys"class="hash-link"aria-label="Direct link to Available context keys"title="Direct link to Available context keys"></a></h3>
<p>Podman Desktop has a set of context keys that are evaluated to Boolean true/false.</p>
<table><thead><tr><th>Context key</th><th>True when</th></tr></thead><tbody><tr><td><strong>Operating system contexts</strong></td><td></td></tr><tr><td>isLinux</td><td>True when the OS is Linux.</td></tr><tr><td>isWindows</td><td>True when the OS is Windows.</td></tr><tr><td>isMac</td><td>True when the OS is macOS.</td></tr></tbody></table>
<p>Podman Desktop also provides context keys that return values that can be used to create meaningful expressions</p>
<table><thead><tr><th>Context key</th><th>Value in it</th></tr></thead><tbody><tr><td>containerLabelKeys</td><td>A list of all labels belonging to the current container. Example: <code>"value in containerLabelKeys"</code></td></tr><tr><td>selectedImageId</td><td>The image id which the dashboard/image menu opened belong to. Example <code>"selectedImageId in imagesPushInProgressToKind"</code></td></tr></tbody></table>
<h3class="anchor anchorWithStickyNavbar_JmGV"id="add-a-custom-when-clause-context">Add a custom when clause context<ahref="#add-a-custom-when-clause-context"class="hash-link"aria-label="Direct link to Add a custom when clause context"title="Direct link to Add a custom when clause context"></a></h3>
<p>If you are creating your own extension and none of the existing keys suit your needs, you can set your own context key by calling the function <code>setValue(key: string, value: any, scope?: 'onboarding')</code> provided by the <code>context</code> namespace in the Podman Desktop API.</p>
<p>The scope, if specified, triggers a custom behavior to avoid any type of collisions between different extensions for that specific scope. Podman Desktop is responsible for handling its state and cleans it accordingly when necessary.</p>
<p>If omitted, the key/value is set globally. For this reason it is recommended to use the extension id as part of the key to avoid unexpected collisions with other extensions.</p>
<p>The first example below sets the key <code>"podmanIsInstalled"</code> to true globally while the second example sets the key <code>"toolInstalled"</code> to <code>oc.exe</code> using the onboarding scope.</p>
<p>After setting the <code>toolInstalled</code> to <code>oc.exe</code>, you could use this information in the <code>when</code> clause to enable something</p>
<h3class="anchor anchorWithStickyNavbar_JmGV"id="conditional-operators">Conditional operators<ahref="#conditional-operators"class="hash-link"aria-label="Direct link to Conditional operators"title="Direct link to Conditional operators"></a></h3>
<p>To create <code>when</code> clauses a bit more complex Podman Desktop offers a set of operators that can be combined with each other.</p>
<h4class="anchor anchorWithStickyNavbar_JmGV"id="logical-operators">Logical operators<ahref="#logical-operators"class="hash-link"aria-label="Direct link to Logical operators"title="Direct link to Logical operators"></a></h4>
<p>Logical operators allow combining simple context keys or when-clause expressions that include other operators</p>
<table><thead><tr><th>Operator</th><th>Symbol</th><th>Example</th></tr></thead><tbody><tr><td>Not</td><td><code>!</code></td><td><code>!podmanIsInstalled</code> or <code>!(podmanIsInstalled && isWindows)</code></td></tr><tr><td>And</td><td><code>&&</code></td><td><code>podmanIsInstalled && isWindows</code></td></tr><tr><td>Or</td><td><code>||</code></td><td><code>isLinux || isWindows</code></td></tr></tbody></table>
<h4class="anchor anchorWithStickyNavbar_JmGV"id="equality-operators">Equality operators<ahref="#equality-operators"class="hash-link"aria-label="Direct link to Equality operators"title="Direct link to Equality operators"></a></h4>
<p>Equality operators allow checking for equality of a context key's value against a specified value.</p>
<p><strong>Note:</strong> the right side is a value and not considered as a context key, so no value is searched in the context. If it contains whitespaces, it must be wrapped in single-quotes (for example <code>'my tool.exe'</code>)</p>
<h4class="anchor anchorWithStickyNavbar_JmGV"id="comparison-operators">Comparison operators<ahref="#comparison-operators"class="hash-link"aria-label="Direct link to Comparison operators"title="Direct link to Comparison operators"></a></h4>
<p>Comparison operator allow comparing a context key's value against a number.</p>
<p><strong>Note:</strong> the left and right side of the operator must be separated by whitespace - <code>bar < 2</code>, but not <code>bar<2</code></p>
<h4class="anchor anchorWithStickyNavbar_JmGV"id="in-and-not-in">In and not in<ahref="#in-and-not-in"class="hash-link"aria-label="Direct link to In and not in"title="Direct link to In and not in"></a></h4>
<p>The <code>in</code>/<code>not in</code> operators allow checking if a value exists/not exists within the other. The right should be a context key, which value is retrieved in the context. The left can be a value or a context key.</p>
<table><thead><tr><th>Operator</th><th>Symbol</th><th>Example</th></tr></thead><tbody><tr><td>In</td><td><code>in</code></td><td><code>label in containerLabelKeys</code></td></tr><tr><td>Not</td><td><code>not in</code></td><td><code>label not in containerLabelKeys</code></td></tr></tbody></table>
<h4class="anchor anchorWithStickyNavbar_JmGV"id="match-operator">Match operator<ahref="#match-operator"class="hash-link"aria-label="Direct link to Match operator"title="Direct link to Match operator"></a></h4>
<p>The match operator allow treating the right side item as a regular expression literal to match against the left side.</p>