update push to docker docs

pull/7471/head
Medya Ghazizadeh 2020-04-06 21:35:21 -07:00 committed by GitHub
parent a577ed0465
commit c433ee128b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 9 deletions

View File

@ -10,7 +10,7 @@ aliases:
- /docs/tasks/docker_daemon - /docs/tasks/docker_daemon
--- ---
## Cached Images # Cached Images
From the host, you can push a Docker image directly to minikube. It will also be cached for future cluster starts. From the host, you can push a Docker image directly to minikube. It will also be cached for future cluster starts.
@ -39,26 +39,34 @@ For more information, see:
You must be using minikube with the container runtime set to Docker. This is the default setting. You must be using minikube with the container runtime set to Docker. This is the default setting.
## Pushing directly to the in-cluster Docker daemon # Pushing directly to the in-cluster Docker daemon
When user a container or VM driver, it's really handy to reuse the Docker daemon inside minikube; as this means you don't have to build on your host machine and push the image into a docker registry - you can just build inside the same docker daemon as minikube which speeds up local experiments.
When using a single VM of Kubernetes it's really handy to reuse the Docker daemon inside the VM; as this means you don't have to build on your host machine and push the image into a docker registry - you can just build inside the same docker daemon as minikube which speeds up local experiments. To point your terminal to use the docker daemon inside minikube run this:
To be able to work with the docker daemon on your mac/linux host use the docker-env command in your shell:
```shell ```shell
eval $(minikube docker-env) eval $(minikube docker-env)
``` ```
You should now be able to use docker on the command line on your host mac/linux machine talking to the docker daemon inside the minikube VM: now any command you run in this current terminal will run against the docker inside minikube VM or Container.
Try it:
```shell ```shell
docker ps docker ps
``` ```
now you can use same docker build command against the docker inside minikube. which is instantly accessible to kubernetes cluster.
'''
docker build -t myimage .
'''
Remember to turn off the `imagePullPolicy:Always` (use `imagePullPolicy:IfNotPresent` or `imagePullPolicy:Never`), as otherwise Kubernetes won't use images you built locally. Remember to turn off the `imagePullPolicy:Always` (use `imagePullPolicy:IfNotPresent` or `imagePullPolicy:Never`), as otherwise Kubernetes won't use images you built locally.
more information on [docker-env](https://minikube.sigs.k8s.io/docs/commands/docker-env/)
## Pushing directly to in-cluster CRIO # Pushing directly to in-cluster CRIO
To push directly to CRIO, configure podman client on your mac/linux host using the podman-env command in your shell: To push directly to CRIO, configure podman client on your mac/linux host using the podman-env command in your shell:
@ -74,7 +82,7 @@ podman-remote help
Remember to turn off the `imagePullPolicy:Always` (use `imagePullPolicy:IfNotPresent` or `imagePullPolicy:Never`), as otherwise Kubernetes won't use images you built locally. Remember to turn off the `imagePullPolicy:Always` (use `imagePullPolicy:IfNotPresent` or `imagePullPolicy:Never`), as otherwise Kubernetes won't use images you built locally.
## Pushing to an in-cluster Registry # Pushing to an in-cluster Registry
For illustration purpose, we will assume that minikube VM has one of the ip from `192.168.39.0/24` subnet. If you have not overridden these subnets as per [networking guide](https://minikube.sigs.k8s.io/reference/networking/), you can find out default subnet being used by minikube for a specific OS and driver combination [here](https://github.com/kubernetes/minikube/blob/dfd9b6b83d0ca2eeab55588a16032688bc26c348/pkg/minikube/cluster/cluster.go#L408) which is subject to change. Replace `192.168.39.0/24` with appropriate values for your environment wherever applicable. For illustration purpose, we will assume that minikube VM has one of the ip from `192.168.39.0/24` subnet. If you have not overridden these subnets as per [networking guide](https://minikube.sigs.k8s.io/reference/networking/), you can find out default subnet being used by minikube for a specific OS and driver combination [here](https://github.com/kubernetes/minikube/blob/dfd9b6b83d0ca2eeab55588a16032688bc26c348/pkg/minikube/cluster/cluster.go#L408) which is subject to change. Replace `192.168.39.0/24` with appropriate values for your environment wherever applicable.
@ -100,7 +108,7 @@ Push docker image to minikube registry:
docker push $(minikube ip):5000/test-img docker push $(minikube ip):5000/test-img
``` ```
## Building images inside of minikube # Building images inside of minikube
Use `minikube ssh` to connect to the virtual machine, and run the `docker build` there: Use `minikube ssh` to connect to the virtual machine, and run the `docker build` there: