Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interact with podman docker via socket in Redhat 9

I'm trying to migrate one of my dev boxes over from centos 8 to RHEL9. I rely heavily on docker and noticed when I tried to run a docker command on the RHEL box it installed podman-docker. This seemed to go smoothly; I was able to pull an image, launch, build, commit a new version without problem using the docker commands I knew already.

The problem I have encountered though is I can't seem to interact with it via the docker socket (which seems to be a link to the podman one).

If I run the docker command:

[@rhel9 ~]$ docker images
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
REPOSITORY             TAG              IMAGE ID      CREATED      SIZE
docker.io/redhat/ubi9  dev_image        de371523ca26  6 hours ago  805 MB
docker.io/redhat/ubi9  latest           9ad46cd10362  6 days ago   230 MB

it has my images listed as expected. I should be able to also run:

[@rhel9 ~]$ curl --unix-socket /var/run/docker.sock -H 'Content-Type: application/json' http://localhost/images/json | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     3  100     3    0     0     55      0 --:--:-- --:--:-- --:--:--    55
[]

but as you can see, nothing is coming back. The socket is up and running as I can ping it without issue:

[@rhel9 ~]$ curl -H "Content-Type: application/json" --unix-socket /var/run/docker.sock http://localhost/_ping
OK

I also tried the curl commands using the podman socket directly but it had the same results. Is there something I am missing or a trick to getting it to work so that I can interact with docker/podman via the socket?

like image 579
incubus Avatar asked Feb 01 '26 12:02

incubus


1 Answers

If you cannot use

systemctl enable --now podman.socket

to create /var/run/podman/podman.sock, because you don't have the root account, you can use

systemctl --user enable --now podman.socket

to create /var/run/user/${UID}/podman/podman.sock which is owned by your current user. Keep in mind that each user (as well as the root user) sees their own podman environment, with different images and different running containers.

If you don't have systemd available, then use

podman system service --time=0 unix:///tmp/podman.sock &

which runs podman in the background (through &) and creates the socket at the given location. Maybe run this with sudo, depending on what you want to do exactly.

like image 94
user7610 Avatar answered Feb 04 '26 02:02

user7610