bradleyd / devops_for_the_desperate

The companion code for the book DevOps for the Desperate
120 stars 67 forks source link

Chapter 6, minikube env #24

Open jasencarroll opened 1 year ago

jasencarroll commented 1 year ago

Hey, I'm not sure if anyone else has run into this. I'm more educated in SDLC and QA so I'm a bit out of my realm playing with this stuff but for what it's worth:

Without including minikube docker-env - I would get this really confusing response. I couldn't quickly find the solution for.

jasen@Renegade:devOps(main*)$ eval $(minikube -p minikube docker-env)
W0315 18:45:42.516285    7508 main.go:291] Unable to resolve the current Docker CLI context "default": context "default" does not exist

I randomly ended up typing:

jasen@Renegade:devOps(main*)$ minikube docker --version
Error: unknown command "docker" for "minikube"

Did you mean this?
    docker-env

Run 'minikube --help' for usage.

And the magic happened.

minikube start --driver=virtualbox
# It's importat to start minikube's docker-env 
minikube docker-env
# export DOCKER_TLS_VERIFY="1"
# export DOCKER_HOST="tcp://192.168.59.105:2376"
# export DOCKER_CERT_PATH="/home/jasen/.minikube/certs"
# export MINIKUBE_ACTIVE_DOCKERD="minikube"
# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)
eval $(minikube -p minikube docker-env)

Additionally, if there is another version planned or something - I'd suggest providing more clarity around the "Installing the Docker Client and Setting Up Docker Environment Variables" Admittedly I am a bit happy to install new software and try things out I initally had docker installed locally with docker desktop and then realized that was a nightmare with VirtualBox so I took care of that and reinstalled the bins and that wouldn't recognize the minikube docker-env either. At one point I was confused if I needed to curl the bins inside of miniKube.

Installing the Docker Client and Setting Up Docker Environment Variables To install the docker client, follow the instructions at https://docs.docker.com/engine/install/binaries/ for your local operating system. (Local is where VirtualBox is running.) Make sure you only download and install the client binary and follow the steps for copying the bin files to your /bin/ file. You’ll use minikube to set some local environment variables in your shell, including the Docker host IP and the path to the Docker host TLS certificates, which are needed to connect. The Bash eval command will source the environment variables in your shell. In a terminal, enter the following to set your Docker environment variables

minikube docker-env
eval $(minikube -p minikube docker-env)

Note: Anyone who has to sudo to get docker --version does not have the proper config.