PhpStorm 2022.2 Help

Podman

Podman is a daemonless container manager that can run containers as root or in rootless mode. Podman commands are fully compatible with Docker, so you can replace one with the other: alias docker=podman.

The core Podman runtime environment can only run on Linux operating systems. However, you can use a remote client for other operating systems to manage containers on the machine running Podman. This topic describes how PhpStorm can act as a remote client for Podman.

You can create a listening service for Podman API calls, which are identical to the Docker Engine API. This enables you to connect PhpStorm to the Podman service via TCP just like you would connect to a Docker Engine API:

  1. Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Docker.

  2. Click The Add button to add a Docker configuration.

  3. Select TCP socket and specify the Podman API service URL in Engine API URL.

For more information, see Docker connection settings.

Tutorial: Run Podman in a virtual machine

If you are using Windows or macOS, you will need a separate Linux machine to run Podman. One of the easier ways to achieve this is to run a Vagrant box with a Linux virtual machine. This tutorial describes how to run Podman on a Vagrant box with Linux, start the Podman API service on it with proper forwarding, and connect to the API from PhpStorm.

Here is what you will need:

Create and run a Vagrant box with Podman

  1. Create a Vagrantfile with the following code:

    Vagrant.configure("2") do |config| config.vm.box = "fedora/32-cloud-base" config.vm.provider "virtualbox" do |vb| vb.memory = "1024" end config.vm.provision "shell", inline: "yum install -y podman" config.vm.network "forwarded_port", guest: 2979, host: 12979, auto_correct: true end

    This Vagrantfile provisions a virtual machine with Fedora and runs it in VirtualBox (Vagrant will download the Fedora box if it is not available). It also installs Podman on the machine and forwards host port 12979 to guest port 2979 on the box. We will use port 12979 to connect to the Podman API from PhpStorm on the host machine.

  2. Run the Vagrant box from the directory where you created the Vagrantfile:

    vagrant up

Start the Podman API service

  1. After the Vagrant box with Fedora starts up, SSH into it:

    vagrant ssh
  2. Run the following command inside the virtual machine:

    podman system service --time=0 tcp:0.0.0.0:2979

    This command will create a listening service that will answer Podman API calls on port number 2979 inside the Vagrant box. This is where port number 12979 is forwarded from the host machine. The session will not expire unless you terminate it manually. If you want to open the service for a limited period of time, change the value of --time to specify the timeout in seconds.

Connect to Podman from PhpStorm

  1. Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Docker.

  2. Click The Add button to add a Docker configuration.

  3. Select TCP socket and specify the Podman API service URL in Engine API URL: tcp://localhost:12979.

    If everything is correct, you should see Connection successful at the bottom of the page.

  4. Double-click the configured Podman connection in the Services tool window (View | Tool Windows | Services or Alt+8).

PhpStorm will make calls to this URL as if to the Docker Engine API, Vagrant will forward them to port 2979 inside the virtual machine with Podman, and the Podman API service will answer these calls.

PhpStorm provides only basic support for Podman. If something doesn't work or not as you would expect, file an issue on YouTrack. To see all existing issues related to Podman support, filter by tag:podman.

Last modified: 01 April 2022