官术网_书友最值得收藏!

Building Docker containers inside the cluster

You might already have Docker installation on your workstation, but when you are working on an application it can improve your workflow to build your images on the Docker daemon running inside the Minikube VM that hosts your Kubernetes cluster. This means that you can skip pushing your images to a Docker repo before using them in Kubernetes. All you need do is build and tag your images, and then refer to them by name in your Kubernetes resources.

If you already have a Docker installation on your workstation, you should already have the command-line client installed that you need to interact with the Minikube Docker daemon. If you don't, it is quite easy to install, either by installing the Docker package for your platform or, if you just want the command-line tool, downloading the binary and copying it into your path.

To correctly configure the Docker CLI to communicate with the Docker demon inside the minikube VM, minikube provides a command that will return environment variables to configure the client:

    minikube docker-env

On Mac or Linux, you can correctly expand these variables into your current shell environment by running:

    eval $(minikube docker-env)

Try running some docker commands to check everything is set up correctly:

    docker version

This should show you the version of Docker running inside the Minikube VM. You might notice that the server version of Docker running in the Minikube VM is a little bit behind the latest version of Docker, since it takes some time for Kubernetes to be tested against new versions of Docker to be considered stable.

Try listing the running containers. You should notice a container running the Kubernetes dashboard, as well as some other services that Kubernetes has launched, such as kube-dns and the addon manager:

    docker ps
主站蜘蛛池模板: 乌恰县| 布尔津县| 吐鲁番市| 屏南县| 朝阳区| 金川县| 荣成市| 霍邱县| 巴里| 共和县| 泰顺县| 扎囊县| 武清区| 黄石市| 玉田县| 四平市| 岳阳县| 吴旗县| 虎林市| 上思县| 墨竹工卡县| 高安市| 钟祥市| 内江市| 柯坪县| 油尖旺区| 惠来县| 丽江市| 广西| 峨山| 奇台县| 黄陵县| 博罗县| 济源市| 石渠县| 环江| 乐山市| 竹溪县| 武宁县| 曲阜市| 丰城市|