cache podman socket address
This commit is contained in:
parent
03e0518f6f
commit
912a3282c5
1 changed files with 11 additions and 2 deletions
13
env/90_podman-socket.zsh
vendored
13
env/90_podman-socket.zsh
vendored
|
|
@ -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
|
||||||
export DOCKER_HOST=unix://$DOCKER_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
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue