cache podman socket address

This commit is contained in:
Alexander Gehrke 2025-03-04 15:02:51 +01:00 committed by Alexander Roso
parent 03e0518f6f
commit 912a3282c5

View file

@ -1,6 +1,15 @@
[[ $- == *i* ]] || return 0 [[ $- == *i* ]] || return 0
local SOCKET_CACHE=$XDG_CACHE_HOME/zsh-podman-socket
if command -v podman &>/dev/null; then if command -v podman &>/dev/null; then
export DOCKER_SOCKET=$(podman system info -f '{{.Host.RemoteSocket.Path}}') local podman_socket
if [[ ! -e $SOCKET_CACHE ]]; then
podman system info -f '{{.Host.RemoteSocket.Path}}' > $SOCKET_CACHE
else
podman_socket=$(<$SOCKET_CACHE)
fi
if [[ -e $podman_socket ]]; then
export DOCKER_SOCKET=$podman_socket
export DOCKER_HOST=unix://$DOCKER_SOCKET export DOCKER_HOST=unix://$DOCKER_SOCKET
fi fi
fi