Podman registry credentials are removed after reboot

Solution Verified - Updated -

Environment

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

Issue

Podman registry credentials are removed after reboot and the user needs to login each time the server is rebooted

Resolution

  • Whenever you login to a registry using $ podman login, authentication token for this user is stored at ${XDG_RUNTIME_DIR}/containers/auth.json where XDG_RUNTIME_DIR is a variable that is defined for this user. In case if this variable corresponds to a location that is not persistent across reboots, the contents are removed when the host is rebooted which results in removal of auth.json file. So, the next time your host comes up, podman is unable to locate this file and you may want to login again after which the file gets created.

  • To have podman logged in to the registry automatically, you need to make sure you're changing the value of XDG_RUNTIME_DIR variable such that it is not deleted when the host is rebooted.

  • Perform the below steps to achieve the same,

    $ echo "export XDG_RUNTIME_DIR=/home/test/example" >> ~/.bashrc ------> This is just an example. You can use any location you want. Make sure it is persistent.

  • Once this is done, auth.json file should be created under /home/test/example/containers/ and this will be present even when the system is rebooted and you need not login every time.

Note: However, this is not a recommended practice as your credentials are stored permanently in your host which may disrupt security.

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.