Last active
November 28, 2021 08:18
-
-
Save jstangroome/f45d7d746a7f440d9684de7bb2b7c07a to your computer and use it in GitHub Desktop.
Minikube on WSL helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$_" = "${BASH_SOURCE}" ] | |
then | |
printf 'source this script, do not execute.\n' >&2 | |
exit 1 | |
fi | |
eval $(minikube docker-env --shell bash) | |
if [ -n "${DOCKER_CERT_PATH}" ] && [ "${DOCKER_CERT_PATH:0:1}" != '/' ] | |
then | |
DOCKER_CERT_PATH=$(wslpath -u "${DOCKER_CERT_PATH}") | |
fi | |
# The following is required to use the Windows docker.exe binary from WSL. | |
# If you intend to use the Linux docker binary only, the following is unnecessary. | |
_add_wslenv="DOCKER_API_VERSION:DOCKER_CERT_PATH/p:DOCKER_HOST:DOCKER_TLS_VERIFY" | |
case "${WSLENV}" in | |
*DOCKER_*) | |
# no-op | |
;; | |
'') | |
WSLENV="${_add_wslenv}" | |
;; | |
*) | |
WSLENV="${WSLENV}:${_add_wslenv}" | |
;; | |
esac | |
unset _add_wslenv | |
export WSLENV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe the first line would be:
if [ "$_" != "${BASH_SOURCE}" ] ?