Skip to content

Instantly share code, notes, and snippets.

@awood
Created April 19, 2023 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awood/c508fcf3c437b10b9888b13a161ad7f0 to your computer and use it in GitHub Desktop.
Save awood/c508fcf3c437b10b9888b13a161ad7f0 to your computer and use it in GitHub Desktop.
Connecting Intellij to Podman

IntelliJ has support for working with Podman but there are some hoops you need to jump through first. The first obstacle is getting the podman API up and running continually. Normally the API is only up while needed and then shuts down. You can change this by creating a local systemd unit file that starts the API server for you when you log in. Here's the unit file:

[Unit]
Description=Podman API Service for IntelliJ
Documentation=man:podman-system-service(1)
StartLimitIntervalSec=0

[Service]
Type=exec
KillMode=process
Environment=LOGGING="--log-level=info"
ExecStart=/usr/bin/podman $LOGGING system service --time=0 tcp:0.0.0.0:12979

[Install]
WantedBy=default.target

Paste that content into ~/.config/systemd/user/podman-intellij.service

Next, run systemctl --user enable podman-intellij and systemctl --user start podman-intellij. The podman-intellij service behaves like a normal systemd unit but you'll need to use the --user argument when you interact with it (e.g. journalctl --user -u podman-intellij).

Now you just need to tell Intellij about this service. Go to you settings (Ctrl+Alt+S), then Build, Execution, Deployment → Docker. Click the plus sign to create a new profile. Name it "Podman". Then click "TCP socket" as the selection for "Connect to the Docker daemon with:". For "Engine API URL" use "tcp://localhost:12979".

That's it. Now you can open the Services tool window and "Podman" should be listed with the Docker whale next to it. You can see a list of your containers and images, the logs of a container, the ports it exposes, the volumes it mounts, etc. You can also start, stop, and delete containers.

The official instructions are located in the IntelliJ docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment