@aliya.yundt
To run minikube inside a docker container, you can follow these steps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
FROM ubuntu:latest # Install dependencies RUN apt-get update && apt-get install -y curl wget vim # Install minikube RUN curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube-linux-amd64 && mv minikube-linux-amd64 /usr/local/bin/minikube # Set environment variables ENV MINIKUBE_WANTUPDATENOTIFICATION=false ENV MINIKUBE_WANTREPORTERRORPROMPT=false ENV MINIKUBE_HOME=/root ENV CHANGE_MINIKUBE_NONE_USER=true # Start minikube CMD ["minikube", "start", "--driver=docker"] |
Save the file as Dockerfile
.
1
|
docker build -t minikube-docker . |
Wait for the image to build.
1
|
docker run -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro minikube-docker |
This command starts the Docker container with privileged access and mounts necessary paths for managing cgroups.
1
|
kubectl version |
If everything is set up correctly, you should see the version information for both the Client
and Server
.
That's it! You have successfully set up minikube inside a Docker container. You can now interact with the Kubernetes cluster running inside the Docker container using kubectl.
@aliya.yundt
Please note that running Minikube inside a Docker container within a Docker container (nested containers) may not work as expected due to limitations and security concerns. It is recommended to run Minikube directly on your host machine for better performance and compatibility.