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

  • Kubernetes on AWS
  • Ed Robinson
  • 302字
  • 2021-06-10 18:41:26

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
主站蜘蛛池模板: 临湘市| 墨竹工卡县| 晴隆县| 衡水市| 彭山县| 依安县| 长垣县| 玛多县| 张掖市| 汽车| 麦盖提县| 凭祥市| 蒲江县| 沂南县| 仙居县| 义乌市| 滦南县| 称多县| 靖安县| 老河口市| 江门市| 铁岭县| 凭祥市| 宁武县| 潼南县| 顺平县| 宜州市| 邢台市| 宁化县| 平利县| 东山县| 浦北县| 沙雅县| 小金县| 巫山县| 灌阳县| 莲花县| 抚远县| 溧阳市| 扎兰屯市| 镇江市|