Docker Engine is available as open source https://docs.docker.com/engine
Docker is licensed under the Apache License, Version 2.0
To make the docker engine work properly in windows 10 there are few features we need to enable
To do that, launch "Turn Windows features on or off" from control panel
And enable the below features
- Containers
- Hyper-V
- Virtual Machine Platform
- Windows Hypervisor Platform
- Windows Subsystem for Linux
Then go to docker exe download site for windows
And download latest zip file
Then unzip to any location you want, Example c:\myfiles\docker
Then launch command prompt in administrator mode and add this location to PATH
set PATH=%PATH%;c:\myfiles\docker
Then in command prompt administrator mode start the daemon , simply type dockerd and enter
dockerd
Then in command prompt administrator mode test any example docker image
docker run hello-world:nanoserver
You will get this output
C:\WINDOWS\system32>docker run hello-world:nanoserver
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(windows-amd64, nanoserver-1809)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run a Windows Server container with:
PS C:\> docker run -it mcr.microsoft.com/windows/servercore:1809 powershell
As you can see it is running the windows-amd64 image
To make desktop-linux work you need minikube
Download minikube.exe from https://github.com/kubernetes/minikube/releases and start it
C:\WINDOWS\system32>minikube start --container-runtime=docker --vm=true
It will install related configuration for Hyper-V and enable the Virtual Switch WSL
Which means you don't have to do it yourself, make sure you don't have another VM created by you otherwise the command lines will get confused and fail
In case there is a timeout issue, then change your Virtual Switch Manager to your WIFI ethernet card or LAN ethernet card
You will get this message
* minikube v1.25.2 on Microsoft Windows 10 Enterprise 10.0.19042 Build 19042
* Automatically selected the hyperv driver
* Starting control plane node minikube in cluster minikube
* Creating hyperv VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...
* Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...
- kubelet.housekeeping-interval=5m
- Generating certificates and keys ...
- Booting up control plane ...
- Configuring RBAC rules ...
* Verifying Kubernetes components...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
now you can write yaml file for your images and use the below commands to make your linux work with kubectl
Now download kubectl.exe for windows from kubernatives website
Sample NGINX yaml file
kind: Service
apiVersion: v1
metadata:
name: nginx
labels:
app: nginx
spec:
selector:
app: nginx
ports:
- port: 80
protocol: TCP
targetPort: 80
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
imagePullPolicy: Always
ports:
- containerPort: 80
protocol: TCP
you can use kubectl as below
C:\MyFiles\app1>kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-8d545c96d-x69vj 1/1 Running 0 4m4s
C:\MyFiles\app1>kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 1/1 1 1 4m41s
C:\MyFiles\app1>kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 12m
nginx ClusterIP 10.109.3.223 <none> 80/TCP 5m5s
kubectl port-forward service/nginx 8080:80
Forwarding from 127.0.0.1:8080 -> 80
Forwarding from [::1]:8080 -> 80
This command will permanently run Now you can open your browser and type
http://localhost:8080/
You will see the below Output
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
Thank you for using nginx.
Thats All :)