Why is podman service in inactive state ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • podman

Issue

  • Podman service is in an inactive state
  • Podman service does not start
  • Podman service stopped sutomatically

Resolution

  • Podman is a binary and a daemonless service. So it does not have any service associated with it. You can launch and run containers even if systemctl shows podman as inactive. More information can be found here.
  • podman service stays active for 5 seconds(by default and can be changed if required) and waits for API calls. If there are no active connections made, it is automatically set to inactive. podman.socket will always to active waiting for connections.
  • Following steps can be followed to keep the podman service active all the time
    1) Copy podman systemd file.

    # cp /usr/lib/systemd/system/podman.service /etc/systemd/system/ 
    

    2) Modify the file according to the below content. We are modifying the service to listen on port 8080 and with a time argument as 0 which indicates the service runs indefinitely until it is stopped.

    # cat /etc/systemd/system/podman.service
    
    [Unit]
    Description=Podman API Service 
    Requires=podman.socket
    After=podman.socket
    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 tcp:127.0.0.1:8080 --time=0
    

    Note: Here you can use "tcp:0.0.0.0:8080" for the API to be available as tcp connection on port 8080. If you do not use this, The default endpoint for a rootful service is unix:/run/podman/podman.sock
    In the last line if you need the API to work only on localhost, replace tcp:0.0.0.0:8080 with tcp:127.0.0.1:8080

    3) Restart podman socket and service.

    # systemctl daemon-reload
    # systemctl enable podman.socket podman
    # systemctl start podman.socket podman
    
  • Now podman service will be running and can be accessed via its API endpoint.

Root Cause

  • Podman is a binary. So it will not have a service running.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments