Minikube common problem - mnhmilu/poc-kubernets GitHub Wiki

To load the Docker environment in Minikube, you can use the eval $(minikube docker-env) command. This command sets up the environment variables necessary to interact with the Docker daemon running inside the Minikube VM. Here's how you can do it:

  1. Start Minikube if it's not already running:

    minikube start
    
  2. Run the following command to load the Docker environment:

    eval $(minikube docker-env)
    

    This command sets up environment variables specific to the Minikube Docker daemon, such as DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, etc. These environment variables will now point your Docker CLI to the Docker daemon inside the Minikube VM.

  3. Verify that the Docker environment is now pointing to Minikube by running a Docker command, such as:

    docker ps
    

    If the command successfully lists the running containers within the Minikube VM, it indicates that the Docker environment has been loaded correctly.

Now, any Docker commands you run from the same terminal session will interact with the Docker daemon inside the Minikube VM. This allows you to build, tag, and push Docker images directly to the Minikube Docker registry, making them accessible for deployments within the Minikube cluster.