DEV Community

Kunal Parikh
Kunal Parikh

Posted on

Docker on macOS via minikube with support for corporate proxies with custom certificate authority

# Set proxy
export HTTPS_PROXY='host:port'
export https_proxy=$HTTPS_PROXY
export HTTP_PROXY=$HTTPS_PROXY
export http_proxy=$HTTPS_PROXY
export NO_PROXY='localhost,127.0.0.1,10.96.0.0/12,192.168.64.112/32,192.168.39.0/24,192.168.49.0/24,192.168.99.0/24'
export no_proxy=$NO_PROXY

# Add Custom Root CAs to
mkdir -p ~/.minikube/certs
# cp /path/to/custom.pem ~/.minikube/certs

# Install
brew install hyperkit
brew install minikube

# Start minikube
minikube start --embed-certs --container-runtime=docker --driver=hyperkit --docker-env HTTP_PROXY=$HTTP_PROXY --docker-env HTTPS_PROXY=$HTTPS_PROXY --docker-env NO_PROXY=$NO_PROXY --docker-env http_proxy=$http_proxy --docker-env https_proxy=$https_proxy --docker-env no_proxy=$no_proxy

# Add minikube's ip to the no proxy list
export NO_PROXY=`minikube ip`,$NO_PROXY
export no_proxy=$NO_PROXY

# Set up Docker
curl -L https://download.docker.com/mac/static/stable/x86_64/docker-20.10.8.tgz | tar -xz  --strip-components=1 -C /usr/local/bin docker/docker
eval $(minikube -p minikube docker-env)
Enter fullscreen mode Exit fullscreen mode

Discussion (0)