Stop systemd from disabling podman socket

I have the following config:

    virtualisation.podman = {
      enable = true;
      dockerSocket.enable = true;
      defaultNetwork.settings.dns_enabled = true;
    };

And the following local files:

~/services/compose.yaml

services:
  caddy:
    build: .
    container_name: caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./conf:/etc/caddy
      - ./site:/srv
      - caddy_data:/data
      - caddy_config:/config
    cap_add:
      - CAP_NET_BIND_SERVICE

volumes:
  caddy_data:
  caddy_config:

~/services/Dockerfile

ARG VERSION=2.11
FROM caddy:${VERSION}-builder-alpine AS builder

RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    xcaddy build \
        --with github.com/lucaslorentz/caddy-docker-proxy/v2

FROM caddy:${VERSION}-alpine

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

CMD ["caddy", "docker-proxy"]

Now if I do podman compose up, I’m getting the following error message:

[caddy] | Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

After looking what might be wrong I saw that the podman service shut down:

Jan 26 07:46:10 pc podman[8418]: time="2026-01-26T07:46:10+01:00" level=info msg="Received shutdown.Stop(), terminating!" PID=8418
Jan 26 07:46:10 pc systemd[1]: podman.service: Deactivated successfully.

Even if I restart the service with sudo systemctl restart podman.service it will shutdown after some seconds. None of those work for more than some seconds:

  • sudo systemctl restart podman.service
  • sudo systemctl restart podman.socket
  • systemctl --user restart podman.service
  • systemctl --user restart podman.socket

I assume it has something to do with https://forums.rockylinux.org/t/podman-gets-shutdown-when-it-starts/17576/2.
I couldn’t find a way to stop the auto-deactivation of the socket. How can I do that?

As far as I can tell, this is your caddy from within the container complaining. You either have to disable its docker integration or bindmount the docker socket.


edit

For more context, I think you are affected by this:

2 Likes

Yeah, after adding a binding to the socket it’s working now.
Here’s the updated compose.yaml:

services:
  caddy:
    build: .
    container_name: caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./conf:/etc/caddy
      - ./site:/srv
      - caddy_data:/data
      - caddy_config:/config
      - /var/run/user/1000/podman/podman.sock:/var/run/docker.sock
    cap_add:
      - CAP_NET_BIND_SERVICE

volumes:
  caddy_data:
  caddy_config:

Thank you!