docker删除映像

    科技2026-08-31  20

    docker删除映像

    This brief post will bring you a quick and an effective way to use your own build docker images / docker image dumps on minikube.

    这篇简短的文章将为您提供一种快速有效的方法,以便在minikube上使用自己的构建docker映像/ docker映像转储。

    There are some articles like this explaining one method to use Own Local Docker Images With Minikube. For some cases: such as when you are building docker images from a library or a programming language tool like ballerina, you might not be able to use the above mentioned method. Example case: Try to compile this ballerina example with having followed previously mentioned method.

    像这样的文章解释了将自己的本地Docker镜像与Minikube一起使用的一种方法。 在某些情况下:例如,当您从库或Ballerina之类的编程语言工具构建docker映像时,您可能无法使用上述方法。 示例情况:遵循前面提到的方法尝试编译此Ballerina示例。

    简单的方法 (Easy way)

    NmyImage with your docker image name. You might need to use sudo privileges to execute docker commands on your local machine.

    N myImage与您的docker映像名称。 您可能需要使用sudo特权才能在本地计算机上执行docker命令。

    Step 1:First, you have to have the docker image dump file. If you have it already, move to step 2. Otherwise, on your local terminal, run following command.

    第1步: 首先,您必须拥有docker映像转储文件。 如果已经有了,请转到步骤2。否则,请在本地终端上运行以下命令。

    docker save myImage > myImage.tar

    Step 2:Copy the image dump file into minikube cluster. Note that you’ll only need to replace image dump file name.

    第2步: 将映像转储文件复制到minikube集群中。 请注意,您只需要替换图像转储文件名。

    scp -i $(minikube ssh-key) myImage.tar docker@$(minikube ip):/home/docker/

    Step 3:ssh into minikube cluster. This will shift your local terminal to the minikube cluster’s terminal.

    第三步: ssh进入minikube集群。 这会将您的本地终端转移到minikube集群的终端。

    minikube ssh

    Load docker image into minikube cluster’s own docker. Run following command on the minikube cluster’s terminal which was opened with previous command.

    将docker映像加载到minikube集群自己的docker中。 在由上一个命令打开的minikube集群终端上运行以下命令。

    docker load -i myImage.tar

    You may check whether the image is loaded correctly by running on the same terminal,

    您可以通过在同一终端上运行来检查图像是否正确加载,

    docker images

    Exit the minikube custer’s terminal by,

    退出minikube custer的终端,

    exit

    Step 4:You’ll need to instruct the kubernetes to not to pull images from the repository by setting the image pull policy to never. You may do this by modifying containers section in your deployment.yaml file.

    第4步: 您需要通过将图像提取策略设置为永不,指示kubernetes不要从存储库中提取图像。 您可以通过修改deployment.yaml文件中的containers部分来执行此操作。

    containers:- image: myImage:v1.0 name: myContainer imagePullPolicy: Never

    Well, that’s it for the easy way of using your own docker images on the minikube. I hope this was a useful exercise to save your time and bandwidth, since the whole point of having minikube on the local machine is to develop and test everything locally. 😊

    好吧,这就是在minikube上使用自己的docker映像的简单方法。 我希望这是节省您的时间和带宽的有用练习,因为在本地计算机上安装minikube的全部目的是在本地开发和测试所有内容。 😊

    翻译自: https://medium.com/swlh/how-to-use-own-docker-images-on-minikube-easy-way-ed96438edf05

    docker删除映像

    Processed: 0.010, SQL: 9