提交 cef7a6fb 编写于 作者: A Alonyb

fix documentation

上级 6bde0e0f
......@@ -11,75 +11,90 @@ Here is a table to help you with registry addon:
| Docker driver on Mac and windows | Random |
| All other drivers | 5000 |
* note1 : The default port for linux drivers is 5000.
* note2 : Drivers for Docker driver is random.
---
## Requirements
* Registry addon enabled
* Run minikube on KIC driver (see table).
## Start minikube enabling registry addon
Open a shell console, and run the following command:
```bash
minikube start --addons=registry --vm-driver={{docker | podman}}
minikube start --addons=registry
```
---
## 1. Usage Registry for drivers that dont need port forward
### How to connec to registry on VM drivers on windows
Build docker image and tag it appropriately:
```shell
docker build --tag $(minikube ip):5000/test-img .
docker build --tag $(minikube ip):$(docker inspect --format '{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}'/test-img .
```
Push docker image to minikube registry:
In order to make docker accept pushing images to this registry, we have to redirect port 5000 on the docker virtual machine over to port 5000 on the minikube machine. Unfortunately, the docker vm cannot directly see the IP address of the minikube vm. To fix this, you will have to add one more level of redirection.
Use kubectl port-forward to map your local workstation to the minikube vm
```shell
kubectl port-forward --namespace kube-system <name of the registry vm> 5000:5000
```
On your local machine you should now be able to reach the minikube registry by using curl `http://localhost:5000/v2/_catalog`
From this point we can (ab)use dockers network configuration to instantiate a container on the dockers host, and run socat there to redirect traffic going to the docker vms port 5000 to port 5000 on your host workstation.
```shell
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:host.docker.internal:5000"
```
Push docker image to minikube registry:
```shell
docker push $(minikube ip):5000/test-img
docker push $(minikube ip):$(docker inspect --format '{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' <container_id>/test-img
```
---
## 2. Use Registry for docker on mac and windows
### How to connect to regsitery for Docker driver on Mac and Windows
Build docker image and tag it appropriately:
#### Accept pushed images on Mac
```shell
docker build --tag $(minikube ip):$(docker inspect --format '{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}'/test-img .
```
In order to make docker accept pushing images to this registry, we have to redirect port 5000 on the docker virtual machine over to port 5000 on the minikube machine. We can (ab)use dockers network configuration to instantiate a container on the dockers host, and run socat there:
```shell
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:host.docker.internal:5000"
```
#### Accept pushing images on Windows
Push docker image to minikube registry:
In order to make docker accept pushing images to this registry, we have to redirect port 5000 on the docker virtual machine over to port 5000 on the minikube machine. Unfortunately, the docker vm cannot directly see the IP address of the minikube vm. To fix this, you will have to add one more level of redirection.
```shell
docker push $(minikube ip):$(docker inspect --format '{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' <container_id>/test-img
```
Use kubectl port-forward to map your local workstation to the minikube vm
### How to connect to resgitry for all other drivers
Build docker image and tag it appropriately:
```shell
kubectl port-forward --namespace kube-system <name of the registry vm> 5000:5000
docker build --tag $(minikube ip):5000'/test-img .
```
On your local machine you should now be able to reach the minikube registry by using curl `http://localhost:5000/v2/_catalog`
From this point we can (ab)use dockers network configuration to instantiate a container on the dockers host, and run socat there to redirect traffic going to the docker vms port 5000 to port 5000 on your host workstation.
In order to make docker accept pushing images to this registry, we have to redirect port 5000 on the docker virtual machine over to port 5000 on the minikube machine. We can (ab)use dockers network configuration to instantiate a container on the dockers host, and run socat there:
```shell
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:host.docker.internal:5000"
```
#### Push docker image to minikube registry:
Push docker image to minikube registry:
```shell
docker push $(minikube ip):$(docker inspect --format '{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' <container_id>/test-img
docker push $(minikube ip):5000 <container_id>/test-img
```
After the image is pushed, refer to it by `localhost:5000/{name}` in kubectl specs.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册